Skip to content

Commit d1295d7

Browse files
cjihrigMoLow
authored andcommitted
test_runner: remove redundant check from coverage
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]>
1 parent 563f9fe commit d1295d7

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

lib/internal/test_runner/coverage.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -377,10 +377,13 @@ function mergeCoverage(merged, coverage) {
377377
const newScript = coverage[i];
378378
const { url } = newScript;
379379

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

0 commit comments

Comments
 (0)