Skip to content

Commit 521dee7

Browse files
fix: ignore lines have to be dropped from coverage and not to be included as covered
1 parent 4488d10 commit 521dee7

File tree

3 files changed

+5
-24
lines changed

3 files changed

+5
-24
lines changed

lib/v8-to-istanbul.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,11 @@ module.exports = class V8ToIstanbul {
281281
s: {}
282282
}
283283
source.lines.forEach((line, index) => {
284+
if (line.ignore) {
285+
return;
286+
}
284287
statements.statementMap[`${index}`] = line.toIstanbul()
285-
statements.s[`${index}`] = line.ignore ? 1 : line.count
288+
statements.s[`${index}`] = line.count
286289
})
287290
return statements
288291
}

tap-snapshots/test/v8-to-istanbul.js.test.cjs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -385,8 +385,6 @@ Object {
385385
"31": 1,
386386
"32": 1,
387387
"33": 1,
388-
"34": 1,
389-
"35": 1,
390388
"36": 1,
391389
"37": 1,
392390
"4": 1,
@@ -677,26 +675,6 @@ Object {
677675
"line": 34,
678676
},
679677
},
680-
"34": Object {
681-
"end": Object {
682-
"column": 22,
683-
"line": 35,
684-
},
685-
"start": Object {
686-
"column": 0,
687-
"line": 35,
688-
},
689-
},
690-
"35": Object {
691-
"end": Object {
692-
"column": 28,
693-
"line": 36,
694-
},
695-
"start": Object {
696-
"column": 0,
697-
"line": 36,
698-
},
699-
},
700678
"36": Object {
701679
"end": Object {
702680
"column": 1,

test/v8-to-istanbul.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ ${'//'}${'#'} sourceMappingURL=data:application/json;base64,${base64Sourcemap}
163163
const coverageMap = v8ToIstanbul.toIstanbul()
164164
const { s } = coverageMap[filename]
165165

166-
assert.deepStrictEqual(s, { 0: 1, 1: 1, 2: 1, 3: 1 })
166+
assert.deepStrictEqual(s, {})
167167
})
168168
})
169169

0 commit comments

Comments
 (0)