diff options
Diffstat (limited to 'cli')
-rw-r--r-- | cli/tests/integration/coverage_tests.rs | 6 | ||||
-rw-r--r-- | cli/tests/testdata/coverage/doesnt_exist.out | 1 | ||||
-rw-r--r-- | cli/tools/coverage/mod.rs | 4 |
3 files changed, 10 insertions, 1 deletions
diff --git a/cli/tests/integration/coverage_tests.rs b/cli/tests/integration/coverage_tests.rs index 4c7a51f4e..497d67890 100644 --- a/cli/tests/integration/coverage_tests.rs +++ b/cli/tests/integration/coverage_tests.rs @@ -630,3 +630,9 @@ File | Branch % | Line % | ", ); } + +itest!(no_files_found { + args: "coverage doesnt_exist.js", + exit_code: 1, + output: "coverage/doesnt_exist.out", +}); diff --git a/cli/tests/testdata/coverage/doesnt_exist.out b/cli/tests/testdata/coverage/doesnt_exist.out new file mode 100644 index 000000000..0b679bcb4 --- /dev/null +++ b/cli/tests/testdata/coverage/doesnt_exist.out @@ -0,0 +1 @@ +error: No coverage files found diff --git a/cli/tools/coverage/mod.rs b/cli/tools/coverage/mod.rs index 28ecc100e..d951d5d5c 100644 --- a/cli/tools/coverage/mod.rs +++ b/cli/tools/coverage/mod.rs @@ -453,8 +453,10 @@ pub async fn cover_files( // Use the first include path as the default output path. let coverage_root = coverage_flags.files.include[0].clone(); - let script_coverages = collect_coverages(coverage_flags.files)?; + if script_coverages.is_empty() { + return Err(generic_error("No coverage files found")); + } let script_coverages = filter_coverages( script_coverages, coverage_flags.include, |