From 3f9be429fc357a01b2f0b05d890dc619bfd4c70b Mon Sep 17 00:00:00 2001 From: Kristiyan Kostadinov Date: Sun, 27 Sep 2020 14:58:57 +0300 Subject: [PATCH] test(compiler-cli): error when running tests on non-posix systems (#39005) We weren't resolving a path correctly which resulted in an error on Windows. For reference, here's the error. Note the extra slash before `C:`: ``` Error: ENOENT: no such file or directory, scandir '/C:/bazel_output_root/yxvwd24o/external/npm/node_modules/typescript' at Object.readdirSync (fs.js:854:3) ``` PR Close #39005 --- packages/compiler-cli/test/helpers/src/mock_file_loading.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 749e57c93d..7a57578910 100644 --- a/packages/compiler-cli/test/helpers/src/mock_file_loading.ts +++ b/packages/compiler-cli/test/helpers/src/mock_file_loading.ts @@ -77,7 +77,9 @@ export function loadFakeCore(fs: FileSystem, basePath: string = '/') { function loadFolder(path: string): Folder { const tmpFs = new MockFileSystemPosix(true); - loadTestDirectory(tmpFs, tmpFs.resolve(path), tmpFs.resolve('/')); + // Note that we intentionally pass the native `path`, without resolving it through the file + // system, because the mock posix file system may break paths coming from a non-posix system. + loadTestDirectory(tmpFs, path, tmpFs.resolve('/')); return tmpFs.dump(); }