mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-26 10:43:51 -05:00
Update user baselines (#24032)
* Strip absolute paths from import types in captured baseline * Accept updated user baselines
This commit is contained in:
@@ -91,14 +91,24 @@ class UserCodeRunner extends ExternalCompileRunnerBase {
|
||||
// tslint:disable-next-line:no-null-keyword
|
||||
return result.status === 0 && !result.stdout.length && !result.stderr.length ? null : `Exit Code: ${result.status}
|
||||
Standard output:
|
||||
${result.stdout.toString().replace(/\r\n/g, "\n")}
|
||||
${stripAbsoluteImportPaths(result.stdout.toString().replace(/\r\n/g, "\n"))}
|
||||
|
||||
|
||||
Standard error:
|
||||
${result.stderr.toString().replace(/\r\n/g, "\n")}`;
|
||||
${stripAbsoluteImportPaths(result.stderr.toString().replace(/\r\n/g, "\n"))}`;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Import types and some other error messages use absolute paths in errors as they have no context to be written relative to;
|
||||
* This is problematic for error baselines, so we grep for them and strip them out.
|
||||
*/
|
||||
function stripAbsoluteImportPaths(result: string) {
|
||||
return result
|
||||
.replace(/import\(".*?\/tests\/cases\/user\//g, `import("/`)
|
||||
.replace(/Module '".*?\/tests\/cases\/user\//g, `Module '"/`);
|
||||
}
|
||||
|
||||
class DefinitelyTypedRunner extends ExternalCompileRunnerBase {
|
||||
readonly testDir = "../DefinitelyTyped/types/";
|
||||
workingDirectory = this.testDir;
|
||||
|
||||
Reference in New Issue
Block a user