Skip to content

Commit 3bc68d3

Browse files
committed
tsc --listFilesOnly
1 parent 27c8f06 commit 3bc68d3

File tree

3 files changed

+195
-0
lines changed

3 files changed

+195
-0
lines changed

internal/execute/tsc_test.go

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,42 @@ func TestTscComposite(t *testing.T) {
289289
}
290290
}
291291

292+
func TestTscListFilesOnly(t *testing.T) {
293+
t.Parallel()
294+
testCases := []*tscInput{
295+
{
296+
subScenario: "loose file",
297+
files: FileMap{
298+
"/home/src/workspaces/project/test.ts": "export const x = 1;",
299+
},
300+
commandLineArgs: []string{"test.ts", "--listFilesOnly"},
301+
},
302+
{
303+
subScenario: "combined with incremental",
304+
files: FileMap{
305+
"/home/src/workspaces/project/test.ts": "export const x = 1;",
306+
"/home/src/workspaces/project/tsconfig.json": "{}",
307+
},
308+
commandLineArgs: []string{"--incremental", "--listFilesOnly"},
309+
edits: []*tscEdit{
310+
{
311+
caption: "incremental actual build",
312+
commandLineArgs: []string{"--incremental"},
313+
},
314+
noChange,
315+
{
316+
caption: "incremental should not build",
317+
commandLineArgs: []string{"--incremental"},
318+
},
319+
},
320+
},
321+
}
322+
323+
for _, testCase := range testCases {
324+
testCase.run(t, "listFilesOnly")
325+
}
326+
}
327+
292328
func TestNoEmit(t *testing.T) {
293329
t.Parallel()
294330
(&tscInput{
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
currentDirectory::/home/src/workspaces/project
2+
useCaseSensitiveFileNames::true
3+
Input::
4+
//// [/home/src/workspaces/project/test.ts] *new*
5+
export const x = 1;
6+
//// [/home/src/workspaces/project/tsconfig.json] *new*
7+
{}
8+
9+
tsgo --incremental --listFilesOnly
10+
ExitStatus:: Success
11+
Output::
12+
/home/src/tslibs/TS/Lib/lib.d.ts
13+
/home/src/workspaces/project/test.ts
14+
//// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib*
15+
/// <reference no-default-lib="true"/>
16+
interface Boolean {}
17+
interface Function {}
18+
interface CallableFunction {}
19+
interface NewableFunction {}
20+
interface IArguments {}
21+
interface Number { toExponential: any; }
22+
interface Object {}
23+
interface RegExp {}
24+
interface String { charAt: any; }
25+
interface Array<T> { length: number; [n: number]: T; }
26+
interface ReadonlyArray<T> {}
27+
interface SymbolConstructor {
28+
(desc?: string | number): symbol;
29+
for(name: string): symbol;
30+
readonly toStringTag: symbol;
31+
}
32+
declare var Symbol: SymbolConstructor;
33+
interface Symbol {
34+
readonly [Symbol.toStringTag]: string;
35+
}
36+
declare const console: { log(msg: any): void; };
37+
38+
tsconfig.json::
39+
SemanticDiagnostics::
40+
*not cached* /home/src/tslibs/TS/Lib/lib.d.ts
41+
*not cached* /home/src/workspaces/project/test.ts
42+
Signatures::
43+
44+
45+
Edit [0]:: incremental actual build
46+
47+
tsgo --incremental
48+
ExitStatus:: Success
49+
Output::
50+
//// [/home/src/workspaces/project/test.js] *new*
51+
"use strict";
52+
Object.defineProperty(exports, "__esModule", { value: true });
53+
exports.x = void 0;
54+
exports.x = 1;
55+
56+
//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *new*
57+
{"version":"FakeTSVersion","root":[2],"fileNames":["lib.d.ts","./test.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// <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> {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"6126f134de98f678e320a9793c4fea1c-export const x = 1;"]}
58+
//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *new*
59+
{
60+
"version": "FakeTSVersion",
61+
"root": [
62+
{
63+
"files": [
64+
"./test.ts"
65+
],
66+
"original": 2
67+
}
68+
],
69+
"fileNames": [
70+
"lib.d.ts",
71+
"./test.ts"
72+
],
73+
"fileInfos": [
74+
{
75+
"fileName": "lib.d.ts",
76+
"version": "8859c12c614ce56ba9a18e58384a198f-/// <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> {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };",
77+
"signature": "8859c12c614ce56ba9a18e58384a198f-/// <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> {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };",
78+
"affectsGlobalScope": true,
79+
"impliedNodeFormat": "CommonJS",
80+
"original": {
81+
"version": "8859c12c614ce56ba9a18e58384a198f-/// <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> {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };",
82+
"affectsGlobalScope": true,
83+
"impliedNodeFormat": 1
84+
}
85+
},
86+
{
87+
"fileName": "./test.ts",
88+
"version": "6126f134de98f678e320a9793c4fea1c-export const x = 1;",
89+
"signature": "6126f134de98f678e320a9793c4fea1c-export const x = 1;",
90+
"impliedNodeFormat": "CommonJS"
91+
}
92+
],
93+
"size": 914
94+
}
95+
96+
tsconfig.json::
97+
SemanticDiagnostics::
98+
*refresh* /home/src/tslibs/TS/Lib/lib.d.ts
99+
*refresh* /home/src/workspaces/project/test.ts
100+
Signatures::
101+
102+
103+
Edit [1]:: no change
104+
105+
tsgo --incremental --listFilesOnly
106+
ExitStatus:: Success
107+
Output::
108+
/home/src/tslibs/TS/Lib/lib.d.ts
109+
/home/src/workspaces/project/test.ts
110+
111+
tsconfig.json::
112+
SemanticDiagnostics::
113+
Signatures::
114+
115+
116+
Edit [2]:: incremental should not build
117+
118+
tsgo --incremental
119+
ExitStatus:: Success
120+
Output::
121+
122+
tsconfig.json::
123+
SemanticDiagnostics::
124+
Signatures::
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
currentDirectory::/home/src/workspaces/project
2+
useCaseSensitiveFileNames::true
3+
Input::
4+
//// [/home/src/workspaces/project/test.ts] *new*
5+
export const x = 1;
6+
7+
tsgo test.ts --listFilesOnly
8+
ExitStatus:: Success
9+
Output::
10+
/home/src/tslibs/TS/Lib/lib.d.ts
11+
/home/src/workspaces/project/test.ts
12+
//// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib*
13+
/// <reference no-default-lib="true"/>
14+
interface Boolean {}
15+
interface Function {}
16+
interface CallableFunction {}
17+
interface NewableFunction {}
18+
interface IArguments {}
19+
interface Number { toExponential: any; }
20+
interface Object {}
21+
interface RegExp {}
22+
interface String { charAt: any; }
23+
interface Array<T> { length: number; [n: number]: T; }
24+
interface ReadonlyArray<T> {}
25+
interface SymbolConstructor {
26+
(desc?: string | number): symbol;
27+
for(name: string): symbol;
28+
readonly toStringTag: symbol;
29+
}
30+
declare var Symbol: SymbolConstructor;
31+
interface Symbol {
32+
readonly [Symbol.toStringTag]: string;
33+
}
34+
declare const console: { log(msg: any): void; };
35+

0 commit comments

Comments
 (0)