From 7b6ea973f6422828e4d64e51b16f4ded0e846636 Mon Sep 17 00:00:00 2001 From: Pete Bacon Darwin Date: Wed, 11 Nov 2020 15:29:42 +0000 Subject: [PATCH] refactor(compiler-cli): return the `FileSystem` from `initMockFileSystem()` (#39617) It is common to want to use the file system once it is initialized, so it makes sense for this function to return it. PR Close #39617 --- .../src/ngtsc/file_system/testing/src/test_helper.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/compiler-cli/src/ngtsc/file_system/testing/src/test_helper.ts b/packages/compiler-cli/src/ngtsc/file_system/testing/src/test_helper.ts index d90af9c89f..28bd7b7bdd 100644 --- a/packages/compiler-cli/src/ngtsc/file_system/testing/src/test_helper.ts +++ b/packages/compiler-cli/src/ngtsc/file_system/testing/src/test_helper.ts @@ -66,10 +66,11 @@ runInEachFileSystem.unix = (callback: (os: string) => void) => runInEachFileSystem.windows = (callback: (os: string) => void) => runInFileSystem(FS_WINDOWS, callback, true); -export function initMockFileSystem(os: string, cwd?: AbsoluteFsPath): void { +export function initMockFileSystem(os: string, cwd?: AbsoluteFsPath): MockFileSystem { const fs = createMockFileSystem(os, cwd); setFileSystem(fs); monkeyPatchTypeScript(os, fs); + return fs; } function createMockFileSystem(os: string, cwd?: AbsoluteFsPath): MockFileSystem {