Skip to content

Commit ceef6f7

Browse files
author
Orta Therox
authored
Dev: Have a clickable link for a new baseline created (#44552)
* Have a clickable link for a new baseline created * Use joinPath instead:
1 parent 5a19533 commit ceef6f7

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/harness/harnessIO.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ namespace Harness {
2525
tryEnableSourceMapsForHost?(): void;
2626
getEnvironmentVariable?(name: string): string;
2727
getMemoryUsage?(): number | undefined;
28+
joinPath(...components: string[]): string
2829
}
2930

3031
export let IO: IO;
@@ -62,6 +63,10 @@ namespace Harness {
6263
return dirPath === path ? undefined : dirPath;
6364
}
6465

66+
function joinPath(...components: string[]) {
67+
return pathModule.join(...components);
68+
}
69+
6570
function enumerateTestFiles(runner: RunnerBase) {
6671
return runner.getTestFiles();
6772
}
@@ -156,6 +161,7 @@ namespace Harness {
156161
tryEnableSourceMapsForHost: () => ts.sys.tryEnableSourceMapsForHost && ts.sys.tryEnableSourceMapsForHost(),
157162
getMemoryUsage: () => ts.sys.getMemoryUsage && ts.sys.getMemoryUsage(),
158163
getEnvironmentVariable: name => ts.sys.getEnvironmentVariable(name),
164+
joinPath
159165
};
160166
}
161167

@@ -1388,7 +1394,12 @@ namespace Harness {
13881394
throw new Error(`The baseline file ${relativeFileName} has changed.${ts.ForegroundColorEscapeSequences.Grey}\n\n${patch}`);
13891395
}
13901396
else {
1391-
throw new Error(`The baseline file ${relativeFileName} has changed.`);
1397+
if (!IO.fileExists(expected)) {
1398+
throw new Error(`New baseline created at ${IO.joinPath("tests", "baselines","local", relativeFileName)}`);
1399+
}
1400+
else {
1401+
throw new Error(`The baseline file ${relativeFileName} has changed.`);
1402+
}
13921403
}
13931404
}
13941405
}

0 commit comments

Comments
 (0)