diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts
index 2eb261499d50f..86a7a188f1853 100644
--- a/src/compiler/commandLineParser.ts
+++ b/src/compiler/commandLineParser.ts
@@ -822,6 +822,7 @@ namespace ts {
{
name: "noErrorTruncation",
type: "boolean",
+ affectsSemanticDiagnostics: true,
category: Diagnostics.Advanced_Options,
description: Diagnostics.Do_not_truncate_error_messages
},
diff --git a/src/testRunner/unittests/tscWatch/programUpdates.ts b/src/testRunner/unittests/tscWatch/programUpdates.ts
index ce3292693a2dc..a8396936bd3b4 100644
--- a/src/testRunner/unittests/tscWatch/programUpdates.ts
+++ b/src/testRunner/unittests/tscWatch/programUpdates.ts
@@ -1164,6 +1164,39 @@ foo().hello`
]
});
+ verifyTscWatch({
+ scenario,
+ subScenario: "updates errors when noErrorTruncation changes",
+ commandLineArgs: ["-w"],
+ sys: () => {
+ const aFile: File = {
+ path: `${projectRoot}/a.ts`,
+ content: `declare var v: {
+ reallyLongPropertyName1: string | number | boolean | object | symbol | bigint;
+ reallyLongPropertyName2: string | number | boolean | object | symbol | bigint;
+ reallyLongPropertyName3: string | number | boolean | object | symbol | bigint;
+ reallyLongPropertyName4: string | number | boolean | object | symbol | bigint;
+ reallyLongPropertyName5: string | number | boolean | object | symbol | bigint;
+ reallyLongPropertyName6: string | number | boolean | object | symbol | bigint;
+ reallyLongPropertyName7: string | number | boolean | object | symbol | bigint;
+};
+v === 'foo';`
+ };
+ const config: File = {
+ path: `${projectRoot}/tsconfig.json`,
+ content: JSON.stringify({ compilerOptions: {} })
+ };
+ return createWatchedSystem([aFile, config, libFile], { currentDirectory: projectRoot });
+ },
+ changes: [
+ sys => {
+ sys.writeFile(`${projectRoot}/tsconfig.json`, JSON.stringify({ compilerOptions: { noErrorTruncation: true } }));
+ sys.runQueuedTimeoutCallbacks();
+ return "Enable noErrorTruncation";
+ },
+ ]
+ });
+
verifyTscWatch({
scenario,
subScenario: "updates diagnostics and emit when useDefineForClassFields changes",
diff --git a/tests/baselines/reference/tscWatch/programUpdates/updates-errors-when-noErrorTruncation-changes.js b/tests/baselines/reference/tscWatch/programUpdates/updates-errors-when-noErrorTruncation-changes.js
new file mode 100644
index 0000000000000..04d87a1e59ef1
--- /dev/null
+++ b/tests/baselines/reference/tscWatch/programUpdates/updates-errors-when-noErrorTruncation-changes.js
@@ -0,0 +1,117 @@
+/a/lib/tsc.js -w
+//// [/user/username/projects/myproject/a.ts]
+declare var v: {
+ reallyLongPropertyName1: string | number | boolean | object | symbol | bigint;
+ reallyLongPropertyName2: string | number | boolean | object | symbol | bigint;
+ reallyLongPropertyName3: string | number | boolean | object | symbol | bigint;
+ reallyLongPropertyName4: string | number | boolean | object | symbol | bigint;
+ reallyLongPropertyName5: string | number | boolean | object | symbol | bigint;
+ reallyLongPropertyName6: string | number | boolean | object | symbol | bigint;
+ reallyLongPropertyName7: string | number | boolean | object | symbol | bigint;
+};
+v === 'foo';
+
+//// [/user/username/projects/myproject/tsconfig.json]
+{"compilerOptions":{}}
+
+//// [/a/lib/lib.d.ts]
+///
+interface Boolean {}
+interface Function {}
+interface CallableFunction {}
+interface NewableFunction {}
+interface IArguments {}
+interface Number { toExponential: any; }
+interface Object {}
+interface RegExp {}
+interface String { charAt: any; }
+interface Array { length: number; [n: number]: T; }
+
+//// [/user/username/projects/myproject/a.js]
+v === 'foo';
+
+
+
+Output::
+>> Screen clear
+12:00:21 AM - Starting compilation in watch mode...
+
+
+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.
+
+
+12:00:24 AM - Found 1 error. Watching for file changes.
+
+
+Program root files: ["/user/username/projects/myproject/a.ts"]
+Program options: {"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"}
+Program files::
+/a/lib/lib.d.ts
+/user/username/projects/myproject/a.ts
+
+Semantic diagnostics in builder refreshed for::
+/a/lib/lib.d.ts
+/user/username/projects/myproject/a.ts
+
+WatchedFiles::
+/user/username/projects/myproject/tsconfig.json:
+ {"pollingInterval":250}
+/user/username/projects/myproject/a.ts:
+ {"pollingInterval":250}
+/a/lib/lib.d.ts:
+ {"pollingInterval":250}
+
+FsWatches::
+
+FsWatchesRecursive::
+/user/username/projects/myproject/node_modules/@types:
+ {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
+/user/username/projects/myproject:
+ {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
+
+exitCode:: ExitStatus.undefined
+
+Change:: Enable noErrorTruncation
+
+//// [/user/username/projects/myproject/tsconfig.json]
+{"compilerOptions":{"noErrorTruncation":true}}
+
+
+Output::
+>> Screen clear
+12:00:28 AM - File change detected. Starting incremental compilation...
+
+
+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.
+
+
+12:00:29 AM - Found 1 error. Watching for file changes.
+
+
+Program root files: ["/user/username/projects/myproject/a.ts"]
+Program options: {"noErrorTruncation":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"}
+Program files::
+/a/lib/lib.d.ts
+/user/username/projects/myproject/a.ts
+
+Semantic diagnostics in builder refreshed for::
+/a/lib/lib.d.ts
+/user/username/projects/myproject/a.ts
+
+WatchedFiles::
+/user/username/projects/myproject/tsconfig.json:
+ {"pollingInterval":250}
+/user/username/projects/myproject/a.ts:
+ {"pollingInterval":250}
+/a/lib/lib.d.ts:
+ {"pollingInterval":250}
+
+FsWatches::
+
+FsWatchesRecursive::
+/user/username/projects/myproject/node_modules/@types:
+ {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
+/user/username/projects/myproject:
+ {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
+
+exitCode:: ExitStatus.undefined