Skip to content

Commit

Permalink
Add test showing how setting strict is not preserved in tsbuildinfo
Browse files Browse the repository at this point in the history
Test for #44305
  • Loading branch information
sheetalkamat committed Jun 2, 2021
1 parent d2516fa commit b6754e4
Show file tree
Hide file tree
Showing 2 changed files with 116 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/testRunner/unittests/tsc/incremental.ts
Original file line number Diff line number Diff line change
Expand Up @@ -400,5 +400,23 @@ declare global {
},
]
});


verifyTscSerializedIncrementalEdits({
scenario: "incremental",
subScenario: "when project has strict true",
commandLineArgs: ["-noEmit", "-p", `src/project`],
fs: () => loadProjectFromFiles({
"/src/project/tsconfig.json": JSON.stringify({
compilerOptions: {
incremental: true,
strict: true,
},
}),
"/src/project/class1.ts": `export class class1 {}`,
}),
incrementalScenarios: noChangeOnlyRuns,
baselinePrograms: true
});
});
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
Input::
//// [/lib/lib.d.ts]
/// <reference no-default-lib="true"/>
interface Boolean {}
interface Function {}
interface CallableFunction {}
interface NewableFunction {}
interface IArguments {}
interface Number { toExponential: any; }
interface Object {}
interface RegExp {}
interface String { charAt: any; }
interface Array<T> { length: number; [n: number]: T; }
interface ReadonlyArray<T> {}
declare const console: { log(msg: any): void; };

//// [/src/project/class1.ts]
export class class1 {}

//// [/src/project/tsconfig.json]
{"compilerOptions":{"incremental":true,"strict":true}}



Output::
/lib/tsc -noEmit -p src/project
exitCode:: ExitStatus.Success
Program root files: ["/src/project/class1.ts"]
Program options: {"incremental":true,"strict":true,"noEmit":true,"project":"/src/project","configFilePath":"/src/project/tsconfig.json"}
Program structureReused: Not
Program files::
/lib/lib.d.ts
/src/project/class1.ts

Semantic diagnostics in builder refreshed for::
/lib/lib.d.ts
/src/project/class1.ts


//// [/src/project/tsconfig.tsbuildinfo]
{"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"}

//// [/src/project/tsconfig.tsbuildinfo.readable.baseline.txt]
{
"program": {
"fileNames": [
"../../lib/lib.d.ts",
"./class1.ts"
],
"fileInfos": {
"../../lib/lib.d.ts": {
"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; };",
"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; };",
"affectsGlobalScope": true
},
"./class1.ts": {
"version": "-7660182596-export class class1 {}",
"signature": "-7660182596-export class class1 {}"
}
},
"referencedMap": {},
"exportedModulesMap": {},
"semanticDiagnosticsPerFile": [
"../../lib/lib.d.ts",
"./class1.ts"
],
"affectedFilesPendingEmit": [
[
"./class1.ts",
"Full"
]
]
},
"version": "FakeTSVersion",
"size": 731
}



Change:: no-change-run
Input::


Output::
/lib/tsc -noEmit -p src/project
exitCode:: ExitStatus.Success
Program root files: ["/src/project/class1.ts"]
Program options: {"incremental":true,"strict":true,"noEmit":true,"project":"/src/project","configFilePath":"/src/project/tsconfig.json"}
Program structureReused: Not
Program files::
/lib/lib.d.ts
/src/project/class1.ts

Semantic diagnostics in builder refreshed for::
/lib/lib.d.ts
/src/project/class1.ts


0 comments on commit b6754e4

Please sign in to comment.