mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Forbid duplicate tests only in compiler+fourslash runner (#44752)
* Forbid duplicate tests only in compiler runner Not in fourslash, user, docker, etc. * Include fourslash, but exempt shims and server
This commit is contained in:
@@ -9,15 +9,17 @@ namespace Harness {
|
||||
const seen = new Map<string, string>();
|
||||
const dupes: [string, string][] = [];
|
||||
for (const runner of runners) {
|
||||
for (const sf of runner.enumerateTestFiles()) {
|
||||
const full = typeof sf === "string" ? sf : sf.file;
|
||||
const base = vpath.basename(full).toLowerCase();
|
||||
// exempt fourslash-fourslash conflicts since they're less likely to emit baselines
|
||||
if (seen.has(base) && !(/fourslash/.test(seen.get(base)!) && /fourslash/.test(full))) {
|
||||
dupes.push([seen.get(base)!, full]);
|
||||
}
|
||||
else {
|
||||
seen.set(base, full);
|
||||
if (runner instanceof CompilerBaselineRunner || runner instanceof FourSlashRunner) {
|
||||
for (const sf of runner.enumerateTestFiles()) {
|
||||
const full = typeof sf === "string" ? sf : sf.file;
|
||||
const base = vpath.basename(full).toLowerCase();
|
||||
// allow existing dupes in fourslash/shims and fourslash/server
|
||||
if (seen.has(base) && !/fourslash\/(shim|server)/.test(full)) {
|
||||
dupes.push([seen.get(base)!, full]);
|
||||
}
|
||||
else {
|
||||
seen.set(base, full);
|
||||
}
|
||||
}
|
||||
}
|
||||
runner.initializeTests();
|
||||
|
||||
Reference in New Issue
Block a user