Skip to content

Commit

Permalink
test_runner: remove redundant check from coverage
Browse files Browse the repository at this point in the history
The code coverage reporting logic already filters out URLs that
don't start with 'file:', so there is no need to also filter
out URLs that start with 'node:'.

PR-URL: #48070
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Moshe Atlow <[email protected]>
Reviewed-By: Debadree Chatterjee <[email protected]>
  • Loading branch information
cjihrig authored and danielleadams committed Jul 6, 2023
1 parent 71cc43e commit edda045
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/internal/test_runner/coverage.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,10 +377,13 @@ function mergeCoverage(merged, coverage) {
const newScript = coverage[i];
const { url } = newScript;

// Filter out core modules and the node_modules/ directory from results.
if (StringPrototypeStartsWith(url, 'node:') ||
StringPrototypeIncludes(url, '/node_modules/') ||
// On Windows some generated coverages are invalid.
// The first part of this check filters out the node_modules/ directory
// from the results. This filter is applied first because most real world
// applications will be dominated by third party dependencies. The second
// part of the check filters out core modules, which start with 'node:' in
// coverage reports, as well as any invalid coverages which have been
// observed on Windows.
if (StringPrototypeIncludes(url, '/node_modules/') ||
!StringPrototypeStartsWith(url, 'file:')) {
continue;
}
Expand Down

0 comments on commit edda045

Please sign in to comment.