From ceef6f7cfdae26bf0ca31600cf2ca129bd26297f Mon Sep 17 00:00:00 2001 From: Orta Therox Date: Tue, 3 Aug 2021 16:18:39 +0100 Subject: [PATCH] Dev: Have a clickable link for a new baseline created (#44552) * Have a clickable link for a new baseline created * Use joinPath instead: --- src/harness/harnessIO.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/harness/harnessIO.ts b/src/harness/harnessIO.ts index a34e4a6e45f..b33c4d5c590 100644 --- a/src/harness/harnessIO.ts +++ b/src/harness/harnessIO.ts @@ -25,6 +25,7 @@ namespace Harness { tryEnableSourceMapsForHost?(): void; getEnvironmentVariable?(name: string): string; getMemoryUsage?(): number | undefined; + joinPath(...components: string[]): string } export let IO: IO; @@ -62,6 +63,10 @@ namespace Harness { return dirPath === path ? undefined : dirPath; } + function joinPath(...components: string[]) { + return pathModule.join(...components); + } + function enumerateTestFiles(runner: RunnerBase) { return runner.getTestFiles(); } @@ -156,6 +161,7 @@ namespace Harness { tryEnableSourceMapsForHost: () => ts.sys.tryEnableSourceMapsForHost && ts.sys.tryEnableSourceMapsForHost(), getMemoryUsage: () => ts.sys.getMemoryUsage && ts.sys.getMemoryUsage(), getEnvironmentVariable: name => ts.sys.getEnvironmentVariable(name), + joinPath }; } @@ -1388,7 +1394,12 @@ namespace Harness { throw new Error(`The baseline file ${relativeFileName} has changed.${ts.ForegroundColorEscapeSequences.Grey}\n\n${patch}`); } else { - throw new Error(`The baseline file ${relativeFileName} has changed.`); + if (!IO.fileExists(expected)) { + throw new Error(`New baseline created at ${IO.joinPath("tests", "baselines","local", relativeFileName)}`); + } + else { + throw new Error(`The baseline file ${relativeFileName} has changed.`); + } } } }