From dbf1f6b233ac1d30b33c1750b5312d32649f650f Mon Sep 17 00:00:00 2001 From: Pete Bacon Darwin Date: Tue, 28 Apr 2020 20:59:09 +0100 Subject: [PATCH] refactor(compiler-cli): expose `loadTestDirectory()` test helper (#36843) This helper can be useful in other packages to load files from the real disk into a mock file system. PR Close #36843 --- packages/compiler-cli/test/helpers/BUILD.bazel | 1 + packages/compiler-cli/test/helpers/src/mock_file_loading.ts | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/compiler-cli/test/helpers/BUILD.bazel b/packages/compiler-cli/test/helpers/BUILD.bazel index 30e7d3cdf5..480e618f04 100644 --- a/packages/compiler-cli/test/helpers/BUILD.bazel +++ b/packages/compiler-cli/test/helpers/BUILD.bazel @@ -8,6 +8,7 @@ ts_library( srcs = glob([ "**/*.ts", ]), + module_name = "@angular/compiler-cli/test/helpers", deps = [ "//packages:types", "//packages/compiler-cli/src/ngtsc/file_system", diff --git a/packages/compiler-cli/test/helpers/src/mock_file_loading.ts b/packages/compiler-cli/test/helpers/src/mock_file_loading.ts index baf20e7ed4..c3b1727035 100644 --- a/packages/compiler-cli/test/helpers/src/mock_file_loading.ts +++ b/packages/compiler-cli/test/helpers/src/mock_file_loading.ts @@ -66,7 +66,8 @@ export function loadFakeCore(fs: FileSystem, basePath: string = '/') { * @param directoryPath the path to the directory we want to load. * @param mockPath the path within the mock file-system where the directory is to be loaded. */ -function loadTestDirectory(fs: FileSystem, directoryPath: string, mockPath: AbsoluteFsPath): void { +export function loadTestDirectory( + fs: FileSystem, directoryPath: string, mockPath: AbsoluteFsPath): void { readdirSync(directoryPath).forEach(item => { const srcPath = resolve(directoryPath, item); const targetPath = fs.resolve(mockPath, item);