diff --git a/lib/internal/test_runner/coverage.js b/lib/internal/test_runner/coverage.js index 8fa9c872568d1e..9a638c82325c22 100644 --- a/lib/internal/test_runner/coverage.js +++ b/lib/internal/test_runner/coverage.js @@ -193,11 +193,16 @@ class TestCoverage { ObjectAssign(range, mapRangeToLines(range, lines)); if (isBlockCoverage) { - ArrayPrototypePush(branchReports, { - __proto__: null, - line: range.lines[0]?.line, - count: range.count, - }); + // If all lines in the branch are ignored, do not include this + // branch in the coverage report (similar to how ignored lines + // are excluded from DA entries in lcov output). + if (range.ignoredLines !== range.lines.length) { + ArrayPrototypePush(branchReports, { + __proto__: null, + line: range.lines[0]?.line, + count: range.count, + }); + } if (range.count !== 0 || range.ignoredLines === range.lines.length) {