Skip to content

Commit

Permalink
fix: ignore lines have to be dropped from coverage and not to be incl…
Browse files Browse the repository at this point in the history
…uded as covered
  • Loading branch information
anthony-redFox committed Feb 6, 2024
1 parent 4488d10 commit 521dee7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 24 deletions.
5 changes: 4 additions & 1 deletion lib/v8-to-istanbul.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,11 @@ module.exports = class V8ToIstanbul {
s: {}
}
source.lines.forEach((line, index) => {
if (line.ignore) {
return;
}
statements.statementMap[`${index}`] = line.toIstanbul()
statements.s[`${index}`] = line.ignore ? 1 : line.count
statements.s[`${index}`] = line.count
})
return statements
}
Expand Down
22 changes: 0 additions & 22 deletions tap-snapshots/test/v8-to-istanbul.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -385,8 +385,6 @@ Object {
"31": 1,
"32": 1,
"33": 1,
"34": 1,
"35": 1,
"36": 1,
"37": 1,
"4": 1,
Expand Down Expand Up @@ -677,26 +675,6 @@ Object {
"line": 34,
},
},
"34": Object {
"end": Object {
"column": 22,
"line": 35,
},
"start": Object {
"column": 0,
"line": 35,
},
},
"35": Object {
"end": Object {
"column": 28,
"line": 36,
},
"start": Object {
"column": 0,
"line": 36,
},
},
"36": Object {
"end": Object {
"column": 1,
Expand Down
2 changes: 1 addition & 1 deletion test/v8-to-istanbul.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ ${'//'}${'#'} sourceMappingURL=data:application/json;base64,${base64Sourcemap}
const coverageMap = v8ToIstanbul.toIstanbul()
const { s } = coverageMap[filename]

assert.deepStrictEqual(s, { 0: 1, 1: 1, 2: 1, 3: 1 })
assert.deepStrictEqual(s, {})
})
})

Expand Down

0 comments on commit 521dee7

Please sign in to comment.