Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion bin/c8.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ function outputReport () {
tempDirectory: argv.tempDirectory,
watermarks: argv.watermarks,
resolve: argv.resolve,
omitRelative: argv.omitRelative
omitRelative: argv.omitRelative,
wrapperLength: argv.wrapperLength
})
}

Expand Down
4 changes: 4 additions & 0 deletions lib/parse-args.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ yargs()
default: '',
describe: 'resolve paths to alternate base directory'
})
.option('wrapper-length', {
describe: 'how many bytes is the wrapper prefix on executed JavaScript',
type: 'number'
})
.option('omit-relative', {
default: true,
type: 'boolean',
Expand Down
6 changes: 4 additions & 2 deletions lib/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ class Report {
tempDirectory,
watermarks,
resolve,
omitRelative
omitRelative,
wrapperLength
}) {
this.reporter = reporter
this.tempDirectory = tempDirectory
Expand All @@ -26,6 +27,7 @@ class Report {
include: include
})
this.omitRelative = omitRelative
this.wrapperLength = wrapperLength
}
run () {
const map = this._getCoverageMapFromAllCoverageFiles()
Expand All @@ -49,7 +51,7 @@ class Report {
for (const v8ScriptCov of v8ProcessCov.result) {
try {
const path = resolve(this.resolve, v8ScriptCov.url)
const script = v8toIstanbul(path)
const script = v8toIstanbul(path, this.wrapperLength)
script.applyCoverage(v8ScriptCov.functions)
map.merge(script.toIstanbul())
} catch (err) {
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"rimraf": "^2.6.2",
"test-exclude": "^5.0.0",
"uuid": "^3.3.2",
"v8-to-istanbul": "^1.2.0",
"v8-to-istanbul": "^2.0.0",
"yargs": "^12.0.2",
"yargs-parser": "^10.1.0"
},
Expand Down
12 changes: 6 additions & 6 deletions test/integration.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ second
--------------------|----------|----------|----------|----------|-------------------|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
--------------------|----------|----------|----------|----------|-------------------|
All files | 95 | 72.22 | 0 | 95 | |
bin | 87.76 | 62.5 | 100 | 87.76 | |
c8.js | 87.76 | 62.5 | 100 | 87.76 | 35,39,46,47,48,49 |
lib | 96.65 | 62.07 | 100 | 96.65 | |
parse-args.js | 97.47 | 44.44 | 100 | 97.47 | 55,56 |
report.js | 96.15 | 70 | 100 | 96.15 | 56,57,95,96,97 |
All files | 95.11 | 72.22 | 0 | 95.11 | |
bin | 88 | 62.5 | 100 | 88 | |
c8.js | 88 | 62.5 | 100 | 88 | 36,40,47,48,49,50 |
lib | 96.74 | 62.07 | 100 | 96.74 | |
parse-args.js | 97.59 | 44.44 | 100 | 97.59 | 59,60 |
report.js | 96.21 | 70 | 100 | 96.21 | 58,59,97,98,99 |
test/fixtures | 95.16 | 94.12 | 0 | 95.16 | |
async.js | 100 | 100 | 100 | 100 | |
multiple-spawn.js | 100 | 100 | 100 | 100 | |
Expand Down