Skip to content

Commit

Permalink
test_runner: avoid error when coverage line not mappable
Browse files Browse the repository at this point in the history
  • Loading branch information
MoLow committed May 25, 2024
1 parent aaca18b commit 31eb092
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/internal/test_runner/coverage.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,10 @@ class TestCoverage {
const { startOffset, endOffset, count } = ranges[k];
const { lines } = mapRangeToLines(ranges[k], originalLines);

if (lines.length === 0) {
// The range is not mappable. Skip it.
continue;
}
let startEntry = sourceMap
.findEntry(lines[0].line - 1, MathMax(0, startOffset - lines[0].startOffset));
const endEntry = sourceMap
Expand Down

0 comments on commit 31eb092

Please sign in to comment.