diff options
author | Kamil Ogórek <kamil.ogorek@gmail.com> | 2022-12-20 02:29:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-19 20:29:44 -0500 |
commit | 199144daf04dc0f67d1ee775f9f39efeb77562d7 (patch) | |
tree | 95fc0b4d6f7c8772a72b11bb296f25b13014e460 | |
parent | 54d40e008a0905a28569dbeb6f12a1a02189c217 (diff) |
fix(cli): allow for specifying `noErrorTruncation` compiler option (#17127)
Fixes https://github.com/denoland/deno/issues/16568
-rw-r--r-- | cli/args/config_file.rs | 1 | ||||
-rw-r--r-- | cli/schemas/config-file.v1.json | 6 | ||||
-rw-r--r-- | cli/tests/check_tests.rs | 7 | ||||
-rw-r--r-- | cli/tests/testdata/check/no_error_truncation/deno.json | 5 | ||||
-rw-r--r-- | cli/tests/testdata/check/no_error_truncation/main.out | 11 | ||||
-rw-r--r-- | cli/tests/testdata/check/no_error_truncation/main.ts | 12 |
6 files changed, 41 insertions, 1 deletions
diff --git a/cli/args/config_file.rs b/cli/args/config_file.rs index 0fa8e4d61..79e1c5367 100644 --- a/cli/args/config_file.rs +++ b/cli/args/config_file.rs @@ -130,7 +130,6 @@ pub const IGNORED_COMPILER_OPTIONS: &[&str] = &[ "noEmit", "noEmitHelpers", "noEmitOnError", - "noErrorTruncation", "noLib", "noResolve", "out", diff --git a/cli/schemas/config-file.v1.json b/cli/schemas/config-file.v1.json index 67650309e..599427ebe 100644 --- a/cli/schemas/config-file.v1.json +++ b/cli/schemas/config-file.v1.json @@ -87,6 +87,12 @@ }, "markdownDescription": "Specify a set of bundled library declaration files that describe the target runtime environment.\n\nSee more: https://www.typescriptlang.org/tsconfig#lib" }, + "noErrorTruncation": { + "description": "Do not truncate error messages.", + "type": "boolean", + "default": false, + "markdownDescription": "Do not truncate error messages.\n\nSee more: https://www.typescriptlang.org/tsconfig#noErrorTruncation" + }, "noFallthroughCasesInSwitch": { "description": "Enable error reporting for fallthrough cases in switch statements.", "type": "boolean", diff --git a/cli/tests/check_tests.rs b/cli/tests/check_tests.rs index 60f9d3a11..71fb8bb3c 100644 --- a/cli/tests/check_tests.rs +++ b/cli/tests/check_tests.rs @@ -68,6 +68,13 @@ mod check { exit_code: 0, }); + itest!(check_no_error_truncation { + args: "check --quiet check/no_error_truncation/main.ts --config check/no_error_truncation/deno.json", + output: "check/no_error_truncation/main.out", + envs: vec![("NO_COLOR".to_string(), "1".to_string())], + exit_code: 1, + }); + #[test] fn cache_switching_config_then_no_config() { let deno_dir = util::new_deno_dir(); diff --git a/cli/tests/testdata/check/no_error_truncation/deno.json b/cli/tests/testdata/check/no_error_truncation/deno.json new file mode 100644 index 000000000..643707ccc --- /dev/null +++ b/cli/tests/testdata/check/no_error_truncation/deno.json @@ -0,0 +1,5 @@ +{ + "compilerOptions": { + "noErrorTruncation": true + } +} diff --git a/cli/tests/testdata/check/no_error_truncation/main.out b/cli/tests/testdata/check/no_error_truncation/main.out new file mode 100644 index 000000000..13fd5aae4 --- /dev/null +++ b/cli/tests/testdata/check/no_error_truncation/main.out @@ -0,0 +1,11 @@ +error: TS2322 [ERROR]: Type '{ propertyWithAnExceedinglyLongName1: string; propertyWithAnExceedinglyLongName2: string; propertyWithAnExceedinglyLongName3: string; propertyWithAnExceedinglyLongName4: string; propertyWithAnExceedinglyLongName5: string; propertyWithAnExceedinglyLongName6: string; propertyWithAnExceedinglyLongName7: string; propertyWithAnExceedinglyLongName8: string; }' is not assignable to type 'string'. +const _s: string = x; + ~~ + at file:///[WILDCARD]/no_error_truncation/main.ts:12:7 + +TS2454 [ERROR]: Variable 'x' is used before being assigned. +const _s: string = x; + ^ + at file:///[WILDCARD]/no_error_truncation/main.ts:12:20 + +Found 2 errors. diff --git a/cli/tests/testdata/check/no_error_truncation/main.ts b/cli/tests/testdata/check/no_error_truncation/main.ts new file mode 100644 index 000000000..bb1856602 --- /dev/null +++ b/cli/tests/testdata/check/no_error_truncation/main.ts @@ -0,0 +1,12 @@ +let x: { + propertyWithAnExceedinglyLongName1: string; + propertyWithAnExceedinglyLongName2: string; + propertyWithAnExceedinglyLongName3: string; + propertyWithAnExceedinglyLongName4: string; + propertyWithAnExceedinglyLongName5: string; + propertyWithAnExceedinglyLongName6: string; + propertyWithAnExceedinglyLongName7: string; + propertyWithAnExceedinglyLongName8: string; +}; + +const _s: string = x; |