Skip to content

Commit 3f139f6

Browse files
committed
noErrorTruncation affects semantic diagnostics
1 parent afa11d3 commit 3f139f6

File tree

3 files changed

+151
-0
lines changed

3 files changed

+151
-0
lines changed

src/compiler/commandLineParser.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -818,6 +818,7 @@ namespace ts {
818818
{
819819
name: "noErrorTruncation",
820820
type: "boolean",
821+
affectsSemanticDiagnostics: true,
821822
category: Diagnostics.Advanced_Options,
822823
description: Diagnostics.Do_not_truncate_error_messages
823824
},

src/testRunner/unittests/tscWatch/programUpdates.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,6 +1121,39 @@ foo().hello`
11211121
]
11221122
});
11231123

1124+
verifyTscWatch({
1125+
scenario,
1126+
subScenario: "updates errors when noErrorTruncation changes",
1127+
commandLineArgs: ["-w"],
1128+
sys: () => {
1129+
const aFile: File = {
1130+
path: `${projectRoot}/a.ts`,
1131+
content: `declare var v: {
1132+
reallyLongPropertyName1: string | number | boolean | object | symbol | bigint;
1133+
reallyLongPropertyName2: string | number | boolean | object | symbol | bigint;
1134+
reallyLongPropertyName3: string | number | boolean | object | symbol | bigint;
1135+
reallyLongPropertyName4: string | number | boolean | object | symbol | bigint;
1136+
reallyLongPropertyName5: string | number | boolean | object | symbol | bigint;
1137+
reallyLongPropertyName6: string | number | boolean | object | symbol | bigint;
1138+
reallyLongPropertyName7: string | number | boolean | object | symbol | bigint;
1139+
};
1140+
v === 'foo';`
1141+
};
1142+
const config: File = {
1143+
path: `${projectRoot}/tsconfig.json`,
1144+
content: JSON.stringify({ compilerOptions: {} })
1145+
};
1146+
return createWatchedSystem([aFile, config, libFile], { currentDirectory: projectRoot });
1147+
},
1148+
changes: [
1149+
sys => {
1150+
sys.writeFile(`${projectRoot}/tsconfig.json`, JSON.stringify({ compilerOptions: { noErrorTruncation: true } }));
1151+
sys.runQueuedTimeoutCallbacks();
1152+
return "Enable noErrorTruncation";
1153+
},
1154+
]
1155+
});
1156+
11241157
verifyTscWatch({
11251158
scenario,
11261159
subScenario: "updates errors and emit when importsNotUsedAsValues changes",
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
/a/lib/tsc.js -w
2+
//// [/user/username/projects/myproject/a.ts]
3+
declare var v: {
4+
reallyLongPropertyName1: string | number | boolean | object | symbol | bigint;
5+
reallyLongPropertyName2: string | number | boolean | object | symbol | bigint;
6+
reallyLongPropertyName3: string | number | boolean | object | symbol | bigint;
7+
reallyLongPropertyName4: string | number | boolean | object | symbol | bigint;
8+
reallyLongPropertyName5: string | number | boolean | object | symbol | bigint;
9+
reallyLongPropertyName6: string | number | boolean | object | symbol | bigint;
10+
reallyLongPropertyName7: string | number | boolean | object | symbol | bigint;
11+
};
12+
v === 'foo';
13+
14+
//// [/user/username/projects/myproject/tsconfig.json]
15+
{"compilerOptions":{}}
16+
17+
//// [/a/lib/lib.d.ts]
18+
/// <reference no-default-lib="true"/>
19+
interface Boolean {}
20+
interface Function {}
21+
interface CallableFunction {}
22+
interface NewableFunction {}
23+
interface IArguments {}
24+
interface Number { toExponential: any; }
25+
interface Object {}
26+
interface RegExp {}
27+
interface String { charAt: any; }
28+
interface Array<T> { length: number; [n: number]: T; }
29+
30+
//// [/user/username/projects/myproject/a.js]
31+
v === 'foo';
32+
33+
34+
35+
Output::
36+
>> Screen clear
37+
12:00:21 AM - Starting compilation in watch mode...
38+
39+
40+
a.ts(10,1): error TS2367: This condition will always return 'false' since the types '{ reallyLongPropertyName1: string | number | bigint | boolean | symbol | object; reallyLongPropertyName2: string | number | bigint | boolean | symbol | object; reallyLongPropertyName3: string | ... 4 more ... | object; reallyLongPropertyName4: string | ... 4 more ... | object; reallyLongPropertyName5: string | ... 4...' and 'string' have no overlap.
41+
42+
43+
12:00:24 AM - Found 1 error. Watching for file changes.
44+
45+
46+
Program root files: ["/user/username/projects/myproject/a.ts"]
47+
Program options: {"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"}
48+
Program files::
49+
/a/lib/lib.d.ts
50+
/user/username/projects/myproject/a.ts
51+
52+
Semantic diagnostics in builder refreshed for::
53+
/a/lib/lib.d.ts
54+
/user/username/projects/myproject/a.ts
55+
56+
WatchedFiles::
57+
/user/username/projects/myproject/tsconfig.json:
58+
{"pollingInterval":250}
59+
/user/username/projects/myproject/a.ts:
60+
{"pollingInterval":250}
61+
/a/lib/lib.d.ts:
62+
{"pollingInterval":250}
63+
64+
FsWatches::
65+
66+
FsWatchesRecursive::
67+
/user/username/projects/myproject/node_modules/@types:
68+
{"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
69+
/user/username/projects/myproject:
70+
{"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
71+
72+
exitCode:: ExitStatus.undefined
73+
74+
Change:: Enable noErrorTruncation
75+
76+
//// [/user/username/projects/myproject/tsconfig.json]
77+
{"compilerOptions":{"noErrorTruncation":true}}
78+
79+
80+
Output::
81+
>> Screen clear
82+
12:00:28 AM - File change detected. Starting incremental compilation...
83+
84+
85+
a.ts(10,1): error TS2367: This condition will always return 'false' since the types '{ reallyLongPropertyName1: string | number | bigint | boolean | symbol | object; reallyLongPropertyName2: string | number | bigint | boolean | symbol | object; reallyLongPropertyName3: string | number | bigint | boolean | symbol | object; reallyLongPropertyName4: string | number | bigint | boolean | symbol | object; reallyLongPropertyName5: string | number | bigint | boolean | symbol | object; reallyLongPropertyName6: string | number | bigint | boolean | symbol | object; reallyLongPropertyName7: string | number | bigint | boolean | symbol | object; }' and 'string' have no overlap.
86+
87+
88+
12:00:29 AM - Found 1 error. Watching for file changes.
89+
90+
91+
Program root files: ["/user/username/projects/myproject/a.ts"]
92+
Program options: {"noErrorTruncation":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"}
93+
Program files::
94+
/a/lib/lib.d.ts
95+
/user/username/projects/myproject/a.ts
96+
97+
Semantic diagnostics in builder refreshed for::
98+
/a/lib/lib.d.ts
99+
/user/username/projects/myproject/a.ts
100+
101+
WatchedFiles::
102+
/user/username/projects/myproject/tsconfig.json:
103+
{"pollingInterval":250}
104+
/user/username/projects/myproject/a.ts:
105+
{"pollingInterval":250}
106+
/a/lib/lib.d.ts:
107+
{"pollingInterval":250}
108+
109+
FsWatches::
110+
111+
FsWatchesRecursive::
112+
/user/username/projects/myproject/node_modules/@types:
113+
{"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
114+
/user/username/projects/myproject:
115+
{"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
116+
117+
exitCode:: ExitStatus.undefined

0 commit comments

Comments
 (0)