Skip to content

Commit 1ae6b8b

Browse files
authored
Forbid duplicate tests only in compiler+fourslash runner (microsoft#44752)
* Forbid duplicate tests only in compiler runner Not in fourslash, user, docker, etc. * Include fourslash, but exempt shims and server
1 parent dc237b3 commit 1ae6b8b

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/testRunner/runner.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,17 @@ namespace Harness {
99
const seen = new Map<string, string>();
1010
const dupes: [string, string][] = [];
1111
for (const runner of runners) {
12-
for (const sf of runner.enumerateTestFiles()) {
13-
const full = typeof sf === "string" ? sf : sf.file;
14-
const base = vpath.basename(full).toLowerCase();
15-
// exempt fourslash-fourslash conflicts since they're less likely to emit baselines
16-
if (seen.has(base) && !(/fourslash/.test(seen.get(base)!) && /fourslash/.test(full))) {
17-
dupes.push([seen.get(base)!, full]);
18-
}
19-
else {
20-
seen.set(base, full);
12+
if (runner instanceof CompilerBaselineRunner || runner instanceof FourSlashRunner) {
13+
for (const sf of runner.enumerateTestFiles()) {
14+
const full = typeof sf === "string" ? sf : sf.file;
15+
const base = vpath.basename(full).toLowerCase();
16+
// allow existing dupes in fourslash/shims and fourslash/server
17+
if (seen.has(base) && !/fourslash\/(shim|server)/.test(full)) {
18+
dupes.push([seen.get(base)!, full]);
19+
}
20+
else {
21+
seen.set(base, full);
22+
}
2123
}
2224
}
2325
runner.initializeTests();

0 commit comments

Comments
 (0)