mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-23 10:04:47 -05:00
Sanitize version string for syntactically invalid buildinfo baselines (#59932)
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
import { Baseline } from "../../_namespaces/Harness.js";
|
||||
import * as ts from "../../_namespaces/ts.js";
|
||||
import { jsonToReadableText } from "../helpers.js";
|
||||
import { patchHostForBuildInfoReadWrite } from "../helpers/baseline.js";
|
||||
import {
|
||||
fakeTsVersion,
|
||||
patchHostForBuildInfoReadWrite,
|
||||
} from "../helpers/baseline.js";
|
||||
import { getTypeScriptLibTestLocation } from "../helpers/contents.js";
|
||||
import {
|
||||
getSysForSampleProjectReferences,
|
||||
@@ -198,7 +201,10 @@ describe("unittests:: tsbuild:: on 'sample1' project", () => {
|
||||
commandLineArgs: ["--b", "-i", "-v"],
|
||||
edits: [{
|
||||
caption: "tsbuildinfo written has error",
|
||||
edit: sys => sys.prependFile("/home/src/workspaces/project/tsconfig.tsbuildinfo", "Some random string"),
|
||||
edit: sys => {
|
||||
sys.prependFile("/home/src/workspaces/project/tsconfig.tsbuildinfo", "Some random string");
|
||||
sys.replaceFileText("/home/src/workspaces/project/tsconfig.tsbuildinfo", `"version":"${ts.version}"`, `"version":"${fakeTsVersion}"`); // build info won't parse, need to manually sterilize for baseline
|
||||
},
|
||||
}],
|
||||
});
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import * as ts from "../../_namespaces/ts.js";
|
||||
import { dedent } from "../../_namespaces/Utils.js";
|
||||
import { jsonToReadableText } from "../helpers.js";
|
||||
import { fakeTsVersion } from "../helpers/baseline.js";
|
||||
import { compilerOptionsToConfigJson } from "../helpers/contents.js";
|
||||
import {
|
||||
noChangeOnlyRuns,
|
||||
@@ -100,7 +101,10 @@ describe("unittests:: tsc:: incremental::", () => {
|
||||
commandLineArgs: ["-i"],
|
||||
edits: [{
|
||||
caption: "tsbuildinfo written has error",
|
||||
edit: sys => sys.prependFile("/home/src/workspaces/project/tsconfig.tsbuildinfo", "Some random string"),
|
||||
edit: sys => {
|
||||
sys.prependFile("/home/src/workspaces/project/tsconfig.tsbuildinfo", "Some random string");
|
||||
sys.replaceFileText("/home/src/workspaces/project/tsconfig.tsbuildinfo", `"version":"${ts.version}"`, `"version":"${fakeTsVersion}"`); // build info won't parse, need to manually sterilize for baseline
|
||||
},
|
||||
}],
|
||||
});
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ Change:: tsbuildinfo written has error
|
||||
|
||||
Input::
|
||||
//// [/home/src/workspaces/project/tsconfig.tsbuildinfo]
|
||||
Some random string{"fileNames":["../../tslibs/ts/lib/lib.d.ts","./main.ts"],"fileInfos":[{"version":"3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true},"-10726455937-export const x = 10;"],"root":[2],"version":"5.7.0-dev"}
|
||||
Some random string{"fileNames":["../../tslibs/ts/lib/lib.d.ts","./main.ts"],"fileInfos":[{"version":"3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true},"-10726455937-export const x = 10;"],"root":[2],"version":"FakeTSVersion"}
|
||||
|
||||
|
||||
/home/src/tslibs/TS/Lib/tsc.js --b -i -v
|
||||
|
||||
@@ -77,7 +77,7 @@ Change:: tsbuildinfo written has error
|
||||
|
||||
Input::
|
||||
//// [/home/src/workspaces/project/tsconfig.tsbuildinfo]
|
||||
Some random string{"fileNames":["../../tslibs/ts/lib/lib.d.ts","./main.ts"],"fileInfos":[{"version":"3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true},"-10726455937-export const x = 10;"],"root":[2],"version":"5.7.0-dev"}
|
||||
Some random string{"fileNames":["../../tslibs/ts/lib/lib.d.ts","./main.ts"],"fileInfos":[{"version":"3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true},"-10726455937-export const x = 10;"],"root":[2],"version":"FakeTSVersion"}
|
||||
|
||||
|
||||
/home/src/tslibs/TS/Lib/tsc.js -i
|
||||
|
||||
Reference in New Issue
Block a user