Update user baselines (#24032)

* Strip absolute paths from import types in captured baseline

* Accept updated user baselines
This commit is contained in:
Wesley Wigham
2018-05-10 13:08:45 -07:00
committed by GitHub
parent 36ff507079
commit fb49fbbd30
19 changed files with 1600 additions and 2328 deletions

View File

@@ -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;