mirror of
https://github.com/denoland/deno.git
synced 2025-03-03 09:31:22 -05:00
fix(coverage): do not generate script coverage with empty url (#24007)
closes #24004
This commit is contained in:
parent
9aa593cd5d
commit
8b5089e41f
2 changed files with 7 additions and 1 deletions
|
@ -68,12 +68,14 @@ impl crate::worker::CoverageCollector for CoverageCollector {
|
|||
|
||||
let script_coverages = self.take_precise_coverage().await?.result;
|
||||
for script_coverage in script_coverages {
|
||||
// Filter out internal and http/https JS files from being included in coverage reports
|
||||
// Filter out internal and http/https JS files and eval'd scripts
|
||||
// from being included in coverage reports
|
||||
if script_coverage.url.starts_with("ext:")
|
||||
|| script_coverage.url.starts_with("[ext:")
|
||||
|| script_coverage.url.starts_with("http:")
|
||||
|| script_coverage.url.starts_with("https:")
|
||||
|| script_coverage.url.starts_with("node:")
|
||||
|| script_coverage.url.is_empty()
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
4
tests/testdata/coverage/multisource/test.ts
vendored
4
tests/testdata/coverage/multisource/test.ts
vendored
|
@ -20,3 +20,7 @@ Deno.test("qux", () => {
|
|||
Deno.test("quux", () => {
|
||||
quux(false);
|
||||
});
|
||||
|
||||
// Function constructor or eval function generates a new script source internally.
|
||||
// This call ensures that the coverage data for the eval script source is not generated.
|
||||
eval("console.log(1)");
|
||||
|
|
Loading…
Add table
Reference in a new issue