Skip to content

Commit dbf94a0

Browse files
author
Benjamin E. Coe
authored
feat: adds support for 1:many source maps (bcoe#238)
Adds support for 1:many source-maps. These source maps are used by tools like rollup or WebPack to bundle multiple JavaScript source files into one. Refs: istanbuljs/v8-to-istanbul#102
1 parent d9e7249 commit dbf94a0

13 files changed

Lines changed: 190 additions & 7 deletions

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"istanbul-reports": "^3.0.2",
4444
"rimraf": "^3.0.0",
4545
"test-exclude": "^6.0.0",
46-
"v8-to-istanbul": "^4.1.2",
46+
"v8-to-istanbul": "^5.0.0",
4747
"yargs": "^15.0.0",
4848
"yargs-parser": "^18.0.0"
4949
},
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const branch = require('./branch-2')
2+
3+
if (false) {
4+
console.info('unreachable')
5+
} else if (true) {
6+
console.info('reachable')
7+
} else {
8+
console.info('unreachable')
9+
}
10+
11+
branch(true)
12+
branch(false)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module.exports = function branch (a) {
2+
if (a) {
3+
console.info('a = true')
4+
} else if (undefined) {
5+
console.info('unreachable')
6+
} else {
7+
console.info('a = false')
8+
}
9+
}

test/fixtures/source-maps/branches/branches.rollup.js

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/fixtures/source-maps/branches/branches.rollup.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
const Foo = require('./class-2')
2+
3+
const a = new Foo(0)
4+
const b = new Foo(33)
5+
a.methodA()
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
module.exports = class Foo {
2+
constructor (x=33) {
3+
this.x = x ? x : 99
4+
if (this.x) {
5+
console.info('covered')
6+
} else {
7+
console.info('uncovered')
8+
}
9+
this.methodC()
10+
}
11+
methodA () {
12+
console.info('covered')
13+
}
14+
methodB () {
15+
console.info('uncovered')
16+
}
17+
methodC () {
18+
console.info('covered')
19+
}
20+
methodD () {
21+
console.info('uncovered')
22+
}
23+
}

test/fixtures/source-maps/classes/classes.rollup.js

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/fixtures/source-maps/classes/classes.rollup.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)