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
This commit is contained in:
Kristiyan Kostadinov 2020-09-27 14:58:57 +03:00 committed by Alex Rickabaugh
parent 4fd635a03a
commit 3f9be429fc
1 changed files with 3 additions and 1 deletions

View File

@ -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();
}