From 1ae6b8bfb50f1fa9c9075d28e86da7894d8812a1 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Fri, 25 Jun 2021 17:33:31 -0700 Subject: [PATCH] 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 --- src/testRunner/runner.ts | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/testRunner/runner.ts b/src/testRunner/runner.ts index 0c5561332d6..4427390d7f3 100644 --- a/src/testRunner/runner.ts +++ b/src/testRunner/runner.ts @@ -9,15 +9,17 @@ namespace Harness { const seen = new Map(); 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();