Skip to content

Commit bf1f9a0

Browse files
crisbetopkozlowski-opensource
authored andcommitted
test(compiler): attempt to deflake windows tests (#51804)
Another try at deflaking the tests on Windows. I'm trying a couple of fixes here: 1. I noticed that it's usually the indexer tests that fail during flaky runs. These tests also happen to be the only ones that don't pass in the `files` argument of `NgtscTestEnvironment.setup`. When `files` isn't passed in, we don't hit the file path that sets up the `MockFileSystem`. With these changes I make it so that we always initialize the mock file system. 2. The missing file system error usually comes from the `absoluteFrom` call that initializes the optional `workingDir` argument. My theory is that because it's a default value for an argument, it gets called too early before everything is initialized. These changes move the `absoluteFrom` call further down until it's needed. PR Close #51804
1 parent 3b46066 commit bf1f9a0

File tree

1 file changed

+3
-3
lines changed
  • packages/compiler-cli/test/ngtsc

1 file changed

+3
-3
lines changed

packages/compiler-cli/test/ngtsc/env.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,16 @@ export class NgtscTestEnvironment {
4545
/**
4646
* Set up a new testing environment.
4747
*/
48-
static setup(files?: Folder, workingDir: AbsoluteFsPath = absoluteFrom('/')):
49-
NgtscTestEnvironment {
48+
static setup(files: Folder = {}, workingDir?: AbsoluteFsPath): NgtscTestEnvironment {
5049
const fs = getFileSystem();
51-
if (files !== undefined && fs instanceof MockFileSystem) {
50+
if (fs instanceof MockFileSystem) {
5251
fs.init(files);
5352
}
5453

5554
const host = new AugmentedCompilerHost(fs);
5655
setWrapHostForTest(makeWrapHost(host));
5756

57+
workingDir = workingDir ?? absoluteFrom('/');
5858
const env = new NgtscTestEnvironment(fs, fs.resolve('/built'), workingDir);
5959
fs.chdir(workingDir);
6060

0 commit comments

Comments
 (0)