1
0
Fork 0
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:
David Sherret 2022-06-18 12:44:43 -04:00 committed by GitHub
parent fa7cad06de
commit f564497630
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 0 deletions

View file

@ -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"),

View 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

View file

@ -0,0 +1,2 @@
// a file that purposefully will cause an error
class Test

View file

@ -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);

View file

@ -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",