Skip to content

Commit 5b5f88e

Browse files
committed
Add test with incremental program with only d.ts files
1 parent f32c2ea commit 5b5f88e

File tree

4 files changed

+102
-0
lines changed

4 files changed

+102
-0
lines changed

src/testRunner/unittests/tsc/incremental.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,23 @@ namespace ts {
3636
commandLineArgs: ["--p", "src/project", "--rootDir", "src/project/src"],
3737
incrementalScenarios: [noChangeRun]
3838
});
39+
40+
verifyTscIncrementalEdits({
41+
scenario: "incremental",
42+
subScenario: "with only dts files",
43+
fs: () => loadProjectFromFiles({
44+
"/src/project/src/main.d.ts": "export const x = 10;",
45+
"/src/project/src/another.d.ts": "export const y = 10;",
46+
"/src/project/tsconfig.json": "{}",
47+
}),
48+
commandLineArgs: ["--incremental", "--p", "src/project"],
49+
incrementalScenarios: [
50+
noChangeRun,
51+
{
52+
buildKind: BuildKind.IncrementalDtsUnchanged,
53+
modifyFs: fs => appendText(fs, "/src/project/src/main.d.ts", "export const xy = 100;")
54+
}
55+
]
56+
});
3957
});
4058
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
//// [/lib/incremental-declaration-doesnt-changeOutput.txt]
2+
/lib/tsc --incremental --p src/project
3+
exitCode:: 0
4+
5+
6+
//// [/src/project/src/main.d.ts]
7+
export const x = 10;export const xy = 100;
8+
9+
//// [/src/project/tsconfig.tsbuildinfo]
10+
{
11+
"program": {
12+
"fileInfos": {
13+
"../../lib/lib.d.ts": {
14+
"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; };",
15+
"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; };"
16+
},
17+
"./src/another.d.ts": {
18+
"version": "-13729955264-export const y = 10;",
19+
"signature": "-13729955264-export const y = 10;"
20+
},
21+
"./src/main.d.ts": {
22+
"version": "-10808461502-export const x = 10;export const xy = 100;",
23+
"signature": "-10808461502-export const x = 10;export const xy = 100;"
24+
}
25+
},
26+
"options": {
27+
"incremental": true,
28+
"project": "./",
29+
"configFilePath": "./tsconfig.json"
30+
},
31+
"referencedMap": {},
32+
"exportedModulesMap": {},
33+
"semanticDiagnosticsPerFile": [
34+
"../../lib/lib.d.ts",
35+
"./src/another.d.ts",
36+
"./src/main.d.ts"
37+
]
38+
},
39+
"version": "FakeTSVersion"
40+
}
41+
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
//// [/lib/initial-buildOutput.txt]
2+
/lib/tsc --incremental --p src/project
3+
exitCode:: 0
4+
5+
6+
//// [/src/project/tsconfig.tsbuildinfo]
7+
{
8+
"program": {
9+
"fileInfos": {
10+
"../../lib/lib.d.ts": {
11+
"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; };",
12+
"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; };"
13+
},
14+
"./src/another.d.ts": {
15+
"version": "-13729955264-export const y = 10;",
16+
"signature": "-13729955264-export const y = 10;"
17+
},
18+
"./src/main.d.ts": {
19+
"version": "-10726455937-export const x = 10;",
20+
"signature": "-10726455937-export const x = 10;"
21+
}
22+
},
23+
"options": {
24+
"incremental": true,
25+
"project": "./",
26+
"configFilePath": "./tsconfig.json"
27+
},
28+
"referencedMap": {},
29+
"exportedModulesMap": {},
30+
"semanticDiagnosticsPerFile": [
31+
"../../lib/lib.d.ts",
32+
"./src/another.d.ts",
33+
"./src/main.d.ts"
34+
]
35+
},
36+
"version": "FakeTSVersion"
37+
}
38+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
//// [/lib/no-change-runOutput.txt]
2+
/lib/tsc --incremental --p src/project
3+
exitCode:: 0
4+
5+

0 commit comments

Comments
 (0)