Dev: Have a clickable link for a new baseline created (#44552)

* Have a clickable link for a new baseline created

* Use joinPath instead:
This commit is contained in:
Orta Therox 2021-08-03 16:18:39 +01:00 committed by GitHub
parent 5a19533d1b
commit ceef6f7cfd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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.`);
}
}
}
}