mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 12:19:12 +00:00
fix(coverage): don't panic if all covered files are ignored via directive (#29250)
Closes https://github.com/denoland/deno/issues/29218
This commit is contained in:
parent
5ab029db22
commit
2fe200f6ef
6 changed files with 30 additions and 1 deletions
|
@ -740,6 +740,12 @@ pub fn cover_files(
|
|||
}
|
||||
}
|
||||
|
||||
// All covered files, might have had ignore directive and we can end up
|
||||
// with no reports at this point.
|
||||
if file_reports.is_empty() {
|
||||
return Err(anyhow!("No covered files included in the report"));
|
||||
}
|
||||
|
||||
for reporter in reporters {
|
||||
reporter.done(&coverage_root, &file_reports);
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ use super::CoverageReport;
|
|||
use crate::args::CoverageType;
|
||||
use crate::colors;
|
||||
|
||||
#[derive(Default)]
|
||||
#[derive(Default, Debug)]
|
||||
pub struct CoverageStats<'a> {
|
||||
pub line_hit: usize,
|
||||
pub line_miss: usize,
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"tempDir": true,
|
||||
"args": "test --coverage test.ts",
|
||||
"output": "test_coverage.out",
|
||||
"exitCode": 0
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
// deno-coverage-ignore-file
|
||||
|
||||
export function foo() {
|
||||
return "foo";
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
import { foo } from "./lib.ts";
|
||||
|
||||
Deno.test("test", () => {
|
||||
foo();
|
||||
});
|
|
@ -0,0 +1,7 @@
|
|||
Check [WILDCARD]/test.ts
|
||||
running 1 test from ./test.ts
|
||||
test ... ok ([WILDCARD])
|
||||
|
||||
ok | 1 passed | 0 failed ([WILDCARD])
|
||||
|
||||
Error generating coverage report: No covered files included in the report
|
Loading…
Add table
Add a link
Reference in a new issue