mirror of
https://github.com/denoland/deno.git
synced 2024-11-24 15:19:26 -05:00
fix(fmt): should fail --check
on parse error (#14907)
This commit is contained in:
parent
fa7cad06de
commit
f564497630
5 changed files with 16 additions and 0 deletions
|
@ -177,6 +177,12 @@ itest!(fmt_check_ignore {
|
|||
exit_code: 0,
|
||||
});
|
||||
|
||||
itest!(fmt_check_parse_error {
|
||||
args: "fmt --check fmt/parse_error/parse_error.ts",
|
||||
output: "fmt/fmt_check_parse_error.out",
|
||||
exit_code: 1,
|
||||
});
|
||||
|
||||
itest!(fmt_stdin {
|
||||
args: "fmt -",
|
||||
input: Some("const a = 1\n"),
|
||||
|
|
6
cli/tests/testdata/fmt/fmt_check_parse_error.out
vendored
Normal file
6
cli/tests/testdata/fmt/fmt_check_parse_error.out
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
Error checking: [WILDCARD]
|
||||
Line 2, column 7: Expected '{', got '<eof>'
|
||||
|
||||
class Test
|
||||
~~~~
|
||||
error: Found 1 not formatted file in 1 file
|
2
cli/tests/testdata/fmt/parse_error/parse_error.ts
vendored
Normal file
2
cli/tests/testdata/fmt/parse_error/parse_error.ts
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
// a file that purposefully will cause an error
|
||||
class Test
|
|
@ -316,6 +316,7 @@ async fn check_source_files(
|
|||
incremental_cache.update_file(&file_path, &file_text);
|
||||
}
|
||||
Err(e) => {
|
||||
not_formatted_files_count.fetch_add(1, Ordering::Relaxed);
|
||||
let _g = output_lock.lock();
|
||||
eprintln!("Error checking: {}", file_path.to_string_lossy());
|
||||
eprintln!(" {}", e);
|
||||
|
|
|
@ -26,6 +26,7 @@ async function dlint() {
|
|||
":!:cli/dts/**",
|
||||
":!:cli/tests/testdata/encoding/**",
|
||||
":!:cli/tests/testdata/error_syntax.js",
|
||||
":!:cli/tests/testdata/fmt/**",
|
||||
":!:cli/tests/testdata/lint/**",
|
||||
":!:cli/tests/testdata/tsc/**",
|
||||
":!:cli/tsc/*typescript.js",
|
||||
|
|
Loading…
Reference in a new issue