Skip to content

Commit 8535076

Browse files
authored
Do not list output files that just change their modified time when using --listEmittedFiles (#35714)
* Baseline incremental scenarios for listEmittedFiles * Do not list output file that just changes modified time stamp as emitted file Fixes #35605
1 parent 8c1900c commit 8535076

File tree

6 files changed

+586
-13
lines changed

6 files changed

+586
-13
lines changed

src/compiler/tsbuildPublic.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1557,7 +1557,6 @@ namespace ts {
15571557
}
15581558

15591559
host.setModifiedTime(file, now);
1560-
listEmittedFile(state, proj, file);
15611560
}
15621561
}
15631562

src/testRunner/unittests/tsbuild/sample.ts

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -358,18 +358,33 @@ export class cNew {}`);
358358
});
359359
});
360360

361+
const coreChanges: TscIncremental[] = [
362+
{
363+
buildKind: BuildKind.IncrementalDtsChange,
364+
modifyFs: fs => appendText(fs, "/src/core/index.ts", `
365+
export class someClass { }`),
366+
},
367+
{
368+
buildKind: BuildKind.IncrementalDtsUnchanged,
369+
modifyFs: fs => appendText(fs, "/src/core/index.ts", `
370+
class someClass { }`),
371+
}
372+
];
373+
361374
describe("lists files", () => {
362-
verifyTsc({
375+
verifyTscIncrementalEdits({
363376
scenario: "sample1",
364377
subScenario: "listFiles",
365378
fs: () => projFs,
366379
commandLineArgs: ["--b", "/src/tests", "--listFiles"],
380+
incrementalScenarios: coreChanges
367381
});
368-
verifyTsc({
382+
verifyTscIncrementalEdits({
369383
scenario: "sample1",
370384
subScenario: "listEmittedFiles",
371385
fs: () => projFs,
372386
commandLineArgs: ["--b", "/src/tests", "--listEmittedFiles"],
387+
incrementalScenarios: coreChanges
373388
});
374389
});
375390

@@ -382,16 +397,7 @@ export class cNew {}`);
382397
baselineSourceMap: true,
383398
baselineReadFileCalls: true,
384399
incrementalScenarios: [
385-
{
386-
buildKind: BuildKind.IncrementalDtsChange,
387-
modifyFs: fs => appendText(fs, "/src/core/index.ts", `
388-
export class someClass { }`),
389-
},
390-
{
391-
buildKind: BuildKind.IncrementalDtsUnchanged,
392-
modifyFs: fs => appendText(fs, "/src/core/index.ts", `
393-
class someClass { }`),
394-
},
400+
...coreChanges,
395401
{
396402
subScenario: "when logic config changes declaration dir",
397403
buildKind: BuildKind.IncrementalDtsChange,
Lines changed: 209 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,209 @@
1+
//// [/lib/incremental-declaration-changesOutput.txt]
2+
/lib/tsc --b /src/tests --listEmittedFiles
3+
TSFILE: /src/core/index.js
4+
TSFILE: /src/core/index.d.ts.map
5+
TSFILE: /src/core/index.d.ts
6+
TSFILE: /src/core/tsconfig.tsbuildinfo
7+
TSFILE: /src/logic/index.js.map
8+
TSFILE: /src/logic/index.js
9+
TSFILE: /src/logic/index.d.ts
10+
TSFILE: /src/logic/tsconfig.tsbuildinfo
11+
TSFILE: /src/tests/index.js
12+
TSFILE: /src/tests/index.d.ts
13+
TSFILE: /src/tests/tsconfig.tsbuildinfo
14+
exitCode:: ExitStatus.Success
15+
16+
17+
//// [/src/core/index.d.ts]
18+
export declare const someString: string;
19+
export declare function leftPad(s: string, n: number): string;
20+
export declare function multiply(a: number, b: number): number;
21+
export declare class someClass {
22+
}
23+
//# sourceMappingURL=index.d.ts.map
24+
25+
//// [/src/core/index.d.ts.map]
26+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,EAAE,MAAsB,CAAC;AAChD,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB;AAC/D,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB;AAEhE,qBAAa,SAAS;CAAI"}
27+
28+
//// [/src/core/index.js]
29+
"use strict";
30+
exports.__esModule = true;
31+
exports.someString = "HELLO WORLD";
32+
function leftPad(s, n) { return s + n; }
33+
exports.leftPad = leftPad;
34+
function multiply(a, b) { return a * b; }
35+
exports.multiply = multiply;
36+
var someClass = /** @class */ (function () {
37+
function someClass() {
38+
}
39+
return someClass;
40+
}());
41+
exports.someClass = someClass;
42+
43+
44+
//// [/src/core/index.ts]
45+
export const someString: string = "HELLO WORLD";
46+
export function leftPad(s: string, n: number) { return s + n; }
47+
export function multiply(a: number, b: number) { return a * b; }
48+
49+
export class someClass { }
50+
51+
//// [/src/core/tsconfig.tsbuildinfo]
52+
{
53+
"program": {
54+
"fileInfos": {
55+
"../../lib/lib.d.ts": {
56+
"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; };",
57+
"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; };"
58+
},
59+
"./anothermodule.ts": {
60+
"version": "-2676574883-export const World = \"hello\";\r\n",
61+
"signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map"
62+
},
63+
"./index.ts": {
64+
"version": "-13387000654-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n\nexport class someClass { }",
65+
"signature": "-2069755619-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClass {\r\n}\r\n//# sourceMappingURL=index.d.ts.map"
66+
},
67+
"./some_decl.d.ts": {
68+
"version": "-9253692965-declare const dts: any;\r\n",
69+
"signature": "-9253692965-declare const dts: any;\r\n"
70+
}
71+
},
72+
"options": {
73+
"composite": true,
74+
"declaration": true,
75+
"declarationMap": true,
76+
"skipDefaultLibCheck": true,
77+
"listEmittedFiles": true,
78+
"configFilePath": "./tsconfig.json"
79+
},
80+
"referencedMap": {},
81+
"exportedModulesMap": {},
82+
"semanticDiagnosticsPerFile": [
83+
"../../lib/lib.d.ts",
84+
"./anothermodule.ts",
85+
"./index.ts",
86+
"./some_decl.d.ts"
87+
]
88+
},
89+
"version": "FakeTSVersion"
90+
}
91+
92+
//// [/src/logic/index.d.ts] file written with same contents
93+
//// [/src/logic/index.js] file written with same contents
94+
//// [/src/logic/index.js.map] file written with same contents
95+
//// [/src/logic/tsconfig.tsbuildinfo]
96+
{
97+
"program": {
98+
"fileInfos": {
99+
"../../lib/lib.d.ts": {
100+
"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; };",
101+
"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; };"
102+
},
103+
"../core/index.ts": {
104+
"version": "-2069755619-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClass {\r\n}\r\n//# sourceMappingURL=index.d.ts.map",
105+
"signature": "-2069755619-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClass {\r\n}\r\n//# sourceMappingURL=index.d.ts.map"
106+
},
107+
"../core/anothermodule.ts": {
108+
"version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map",
109+
"signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map"
110+
},
111+
"./index.ts": {
112+
"version": "-5786964698-import * as c from '../core/index';\r\nexport function getSecondsInDay() {\r\n return c.multiply(10, 15);\r\n}\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n",
113+
"signature": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n"
114+
}
115+
},
116+
"options": {
117+
"composite": true,
118+
"declaration": true,
119+
"sourceMap": true,
120+
"forceConsistentCasingInFileNames": true,
121+
"skipDefaultLibCheck": true,
122+
"listEmittedFiles": true,
123+
"configFilePath": "./tsconfig.json"
124+
},
125+
"referencedMap": {
126+
"./index.ts": [
127+
"../core/anothermodule.d.ts",
128+
"../core/index.d.ts"
129+
]
130+
},
131+
"exportedModulesMap": {
132+
"./index.ts": [
133+
"../core/anothermodule.d.ts"
134+
]
135+
},
136+
"semanticDiagnosticsPerFile": [
137+
"../../lib/lib.d.ts",
138+
"../core/anothermodule.ts",
139+
"../core/index.ts",
140+
"./index.ts"
141+
]
142+
},
143+
"version": "FakeTSVersion"
144+
}
145+
146+
//// [/src/tests/index.d.ts] file written with same contents
147+
//// [/src/tests/index.js] file written with same contents
148+
//// [/src/tests/tsconfig.tsbuildinfo]
149+
{
150+
"program": {
151+
"fileInfos": {
152+
"../../lib/lib.d.ts": {
153+
"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; };",
154+
"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; };"
155+
},
156+
"../core/index.ts": {
157+
"version": "-2069755619-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClass {\r\n}\r\n//# sourceMappingURL=index.d.ts.map",
158+
"signature": "-2069755619-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClass {\r\n}\r\n//# sourceMappingURL=index.d.ts.map"
159+
},
160+
"../core/anothermodule.ts": {
161+
"version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map",
162+
"signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map"
163+
},
164+
"../logic/index.ts": {
165+
"version": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n",
166+
"signature": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n"
167+
},
168+
"./index.ts": {
169+
"version": "12336236525-import * as c from '../core/index';\r\nimport * as logic from '../logic/index';\r\n\r\nc.leftPad(\"\", 10);\r\nlogic.getSecondsInDay();\r\n\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n",
170+
"signature": "-9209611-import * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n"
171+
}
172+
},
173+
"options": {
174+
"composite": true,
175+
"declaration": true,
176+
"forceConsistentCasingInFileNames": true,
177+
"skipDefaultLibCheck": true,
178+
"listEmittedFiles": true,
179+
"configFilePath": "./tsconfig.json"
180+
},
181+
"referencedMap": {
182+
"../logic/index.ts": [
183+
"../core/anothermodule.d.ts"
184+
],
185+
"./index.ts": [
186+
"../core/anothermodule.d.ts",
187+
"../core/index.d.ts",
188+
"../logic/index.d.ts"
189+
]
190+
},
191+
"exportedModulesMap": {
192+
"../logic/index.ts": [
193+
"../core/anothermodule.d.ts"
194+
],
195+
"./index.ts": [
196+
"../core/anothermodule.d.ts"
197+
]
198+
},
199+
"semanticDiagnosticsPerFile": [
200+
"../../lib/lib.d.ts",
201+
"../core/anothermodule.ts",
202+
"../core/index.ts",
203+
"../logic/index.ts",
204+
"./index.ts"
205+
]
206+
},
207+
"version": "FakeTSVersion"
208+
}
209+

0 commit comments

Comments
 (0)