diff --git a/lib/internal/test_runner/coverage.js b/lib/internal/test_runner/coverage.js index 5a098f71af633b..a20055fa91b601 100644 --- a/lib/internal/test_runner/coverage.js +++ b/lib/internal/test_runner/coverage.js @@ -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; }