diff --git a/crates/biome_cli/tests/cases/reporter_json.rs b/crates/biome_cli/tests/cases/reporter_json.rs index 2779e6df4010..0e01bb870ef8 100644 --- a/crates/biome_cli/tests/cases/reporter_json.rs +++ b/crates/biome_cli/tests/cases/reporter_json.rs @@ -208,6 +208,43 @@ fn reports_diagnostics_json_check_command_file() { )); } +#[test] +fn reports_diagnostics_json_compact_check_command_file() { + let fs = MemoryFileSystem::default(); + let mut console = BufferConsole::default(); + + let file_path1 = Utf8Path::new("main.ts"); + fs.insert(file_path1.into(), MAIN_1.as_bytes()); + + let file_path2 = Utf8Path::new("index.ts"); + fs.insert(file_path2.into(), MAIN_2.as_bytes()); + + let (fs, result) = run_cli( + fs, + &mut console, + Args::from( + [ + "check", + "--reporter=json", + "--reporter-file=file.json", + file_path1.as_str(), + file_path2.as_str(), + ] + .as_slice(), + ), + ); + + assert!(result.is_err(), "run_cli returned {result:?}"); + + assert_cli_snapshot(SnapshotPayload::new( + module_path!(), + "reports_diagnostics_json_compact_check_command_file", + fs, + console, + result, + )); +} + #[test] fn reports_diagnostics_json_with_escaped_quotes() { let fs = MemoryFileSystem::default(); diff --git a/crates/biome_cli/tests/snapshots/main_cases_reporter_json/reports_diagnostics_json_compact_check_command_file.snap b/crates/biome_cli/tests/snapshots/main_cases_reporter_json/reports_diagnostics_json_compact_check_command_file.snap new file mode 100644 index 000000000000..e160f815dff3 --- /dev/null +++ b/crates/biome_cli/tests/snapshots/main_cases_reporter_json/reports_diagnostics_json_compact_check_command_file.snap @@ -0,0 +1,54 @@ +--- +source: crates/biome_cli/tests/snap_test.rs +expression: redactor(content) +--- +## `file.json` + +```json +{"summary":{"changed":0,"unchanged":2,"matches":0,"duration":"