diff options
author | Nathan Whitaker <17734409+nathanwhit@users.noreply.github.com> | 2024-03-15 20:58:57 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-15 20:58:57 -0700 |
commit | ab67b4c645dc34619e09c2f9f36c18122b11a307 (patch) | |
tree | c35ad60b1fbe05218c9e22e5ad64f7b04f9ed2db /cli/tools/coverage | |
parent | 92576fdcfd3e32dce63b533ab20d4974136b097d (diff) |
fix(coverage): Error if no files are included in the report (#22952)
Fixes #22941.
In that case, the only file with coverage was the `test.ts` file. The
coverage reporter filters out test files before compiling its report, so
after filtering we were left with an empty set of files. Later on it's
assumed that there is at least 1 file to be reported on, and we panic.
Instead of panicking, just issue an error after filtering.
Diffstat (limited to 'cli/tools/coverage')
-rw-r--r-- | cli/tools/coverage/mod.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/cli/tools/coverage/mod.rs b/cli/tools/coverage/mod.rs index e5bd3ae2e..b07689570 100644 --- a/cli/tools/coverage/mod.rs +++ b/cli/tools/coverage/mod.rs @@ -485,6 +485,9 @@ pub async fn cover_files( coverage_flags.exclude, npm_resolver.as_ref(), ); + if script_coverages.is_empty() { + return Err(generic_error("No covered files included in the report")); + } let proc_coverages: Vec<_> = script_coverages .into_iter() |