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 <duhamelantoine1995@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Debadree Chatterjee <debadree333@gmail.com>
  • Loading branch information
cjihrig authored and targos committed May 30, 2023
1 parent 802db92 commit 15336c3
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 15336c3

Please sign in to comment.