Skip to content

Commit ecd2ae8

Browse files
authored
Deduplicate inputfiles before running RWC tests (#17877)
* Deduplicate inputfiles before running RWC tests We deduplicate in the compiler, but we don't in the harness - this causes tests where the same file is listed multiple times in the arguments to not have the expected errors written, because we write out the same file multiple times when we should not. * Don't completely omit both copied of duplicates * Remove trailing whitespace * Maintain list order while filtering duplicates * Merge adjacent loops
1 parent 487ba21 commit ecd2ae8

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/harness/rwcRunner.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,16 @@ namespace RWC {
9090
ts.setConfigFileInOptions(opts.options, configParseResult.options.configFile);
9191
}
9292

93-
// Load the files
93+
// Deduplicate files so they are only printed once in baselines (they are deduplicated within the compiler already)
94+
const uniqueNames = ts.createMap<true>();
9495
for (const fileName of fileNames) {
95-
inputFiles.push(getHarnessCompilerInputUnit(fileName));
96+
// Must maintain order, build result list while checking map
97+
const normalized = ts.normalizeSlashes(fileName);
98+
if (!uniqueNames.has(normalized)) {
99+
uniqueNames.set(normalized, true);
100+
// Load the file
101+
inputFiles.push(getHarnessCompilerInputUnit(fileName));
102+
}
96103
}
97104

98105
// Add files to compilation

0 commit comments

Comments
 (0)