Skip to content

Commit b6754e4

Browse files
committed
Add test showing how setting strict is not preserved in tsbuildinfo
Test for microsoft#44305
1 parent d2516fa commit b6754e4

File tree

2 files changed

+116
-0
lines changed

2 files changed

+116
-0
lines changed

src/testRunner/unittests/tsc/incremental.ts

+18
Original file line numberDiff line numberDiff line change
@@ -400,5 +400,23 @@ declare global {
400400
},
401401
]
402402
});
403+
404+
405+
verifyTscSerializedIncrementalEdits({
406+
scenario: "incremental",
407+
subScenario: "when project has strict true",
408+
commandLineArgs: ["-noEmit", "-p", `src/project`],
409+
fs: () => loadProjectFromFiles({
410+
"/src/project/tsconfig.json": JSON.stringify({
411+
compilerOptions: {
412+
incremental: true,
413+
strict: true,
414+
},
415+
}),
416+
"/src/project/class1.ts": `export class class1 {}`,
417+
}),
418+
incrementalScenarios: noChangeOnlyRuns,
419+
baselinePrograms: true
420+
});
403421
});
404422
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
Input::
2+
//// [/lib/lib.d.ts]
3+
/// <reference no-default-lib="true"/>
4+
interface Boolean {}
5+
interface Function {}
6+
interface CallableFunction {}
7+
interface NewableFunction {}
8+
interface IArguments {}
9+
interface Number { toExponential: any; }
10+
interface Object {}
11+
interface RegExp {}
12+
interface String { charAt: any; }
13+
interface Array<T> { length: number; [n: number]: T; }
14+
interface ReadonlyArray<T> {}
15+
declare const console: { log(msg: any): void; };
16+
17+
//// [/src/project/class1.ts]
18+
export class class1 {}
19+
20+
//// [/src/project/tsconfig.json]
21+
{"compilerOptions":{"incremental":true,"strict":true}}
22+
23+
24+
25+
Output::
26+
/lib/tsc -noEmit -p src/project
27+
exitCode:: ExitStatus.Success
28+
Program root files: ["/src/project/class1.ts"]
29+
Program options: {"incremental":true,"strict":true,"noEmit":true,"project":"/src/project","configFilePath":"/src/project/tsconfig.json"}
30+
Program structureReused: Not
31+
Program files::
32+
/lib/lib.d.ts
33+
/src/project/class1.ts
34+
35+
Semantic diagnostics in builder refreshed for::
36+
/lib/lib.d.ts
37+
/src/project/class1.ts
38+
39+
40+
//// [/src/project/tsconfig.tsbuildinfo]
41+
{"program":{"fileNames":["../../lib/lib.d.ts","./class1.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},"-7660182596-export class class1 {}"],"referencedMap":[],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,2],"affectedFilesPendingEmit":[[2,1]]},"version":"FakeTSVersion"}
42+
43+
//// [/src/project/tsconfig.tsbuildinfo.readable.baseline.txt]
44+
{
45+
"program": {
46+
"fileNames": [
47+
"../../lib/lib.d.ts",
48+
"./class1.ts"
49+
],
50+
"fileInfos": {
51+
"../../lib/lib.d.ts": {
52+
"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; };",
53+
"signature": "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; };",
54+
"affectsGlobalScope": true
55+
},
56+
"./class1.ts": {
57+
"version": "-7660182596-export class class1 {}",
58+
"signature": "-7660182596-export class class1 {}"
59+
}
60+
},
61+
"referencedMap": {},
62+
"exportedModulesMap": {},
63+
"semanticDiagnosticsPerFile": [
64+
"../../lib/lib.d.ts",
65+
"./class1.ts"
66+
],
67+
"affectedFilesPendingEmit": [
68+
[
69+
"./class1.ts",
70+
"Full"
71+
]
72+
]
73+
},
74+
"version": "FakeTSVersion",
75+
"size": 731
76+
}
77+
78+
79+
80+
Change:: no-change-run
81+
Input::
82+
83+
84+
Output::
85+
/lib/tsc -noEmit -p src/project
86+
exitCode:: ExitStatus.Success
87+
Program root files: ["/src/project/class1.ts"]
88+
Program options: {"incremental":true,"strict":true,"noEmit":true,"project":"/src/project","configFilePath":"/src/project/tsconfig.json"}
89+
Program structureReused: Not
90+
Program files::
91+
/lib/lib.d.ts
92+
/src/project/class1.ts
93+
94+
Semantic diagnostics in builder refreshed for::
95+
/lib/lib.d.ts
96+
/src/project/class1.ts
97+
98+

0 commit comments

Comments
 (0)