Skip to content

Commit

Permalink
fix: float patch for branch/function coverage merge bug (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoe committed Jan 20, 2019
1 parent 7fd9e13 commit 1de0cca
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 26 deletions.
10 changes: 8 additions & 2 deletions .travis.yml
@@ -1,4 +1,10 @@
language: node_js
os:
- linux
- osx
# need to figure out why offsets
# are slightly off on Windows.
# - windows
node_js:
- "10.10"
after_success: npm run coverage
- "11"
after_success: npm run coverage
12 changes: 9 additions & 3 deletions lib/report.js
Expand Up @@ -4,8 +4,9 @@ const libCoverage = require('istanbul-lib-coverage')
const libReport = require('istanbul-lib-report')
const reports = require('istanbul-reports')
const { readdirSync, readFileSync } = require('fs')
const { resolve, isAbsolute } = require('path')
const { mergeProcessCovs } = require('@c88/v8-coverage')
const { isAbsolute, resolve } = require('path')
// TODO: switch back to @c88/v8-coverage once patch is landed.
const { mergeProcessCovs } = require('@bcoe/v8-coverage')
const v8toIstanbul = require('v8-to-istanbul')

class Report {
Expand Down Expand Up @@ -120,7 +121,12 @@ class Report {
const result = []
for (const v8ScriptCov of v8ProcessCov.result) {
if (/^file:\/\//.test(v8ScriptCov.url)) {
v8ScriptCov.url = furi.toSysPath(v8ScriptCov.url)
try {
v8ScriptCov.url = furi.toSysPath(v8ScriptCov.url)
} catch (err) {
console.warn(err)
continue
}
}
if (this.exclude.shouldInstrument(v8ScriptCov.url) &&
(!this.omitRelative || isAbsolute(v8ScriptCov.url))) {
Expand Down
22 changes: 11 additions & 11 deletions package-lock.json

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

6 changes: 3 additions & 3 deletions package.json
Expand Up @@ -32,17 +32,17 @@
"author": "Ben Coe <ben@npmjs.com>",
"license": "ISC",
"dependencies": {
"@c88/v8-coverage": "^0.1.0",
"@bcoe/v8-coverage": "^0.1.0",
"find-up": "^3.0.0",
"foreground-child": "^1.5.6",
"furi": "^1.0.0",
"furi": "^1.3.0",
"istanbul-lib-coverage": "^2.0.1",
"istanbul-lib-report": "^2.0.1",
"istanbul-reports": "^2.0.0",
"rimraf": "^2.6.2",
"test-exclude": "^5.0.0",
"uuid": "^3.3.2",
"v8-to-istanbul": "^2.0.0",
"v8-to-istanbul": "^2.0.1",
"yargs": "^12.0.2",
"yargs-parser": "^10.1.0"
},
Expand Down
14 changes: 7 additions & 7 deletions test/integration.js.snap
Expand Up @@ -8,16 +8,16 @@ second
--------------------|----------|----------|----------|----------|-------------------|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
--------------------|----------|----------|----------|----------|-------------------|
All files | 94.59 | 70.91 | 0 | 94.59 | |
All files | 94.4 | 71.43 | 95 | 94.4 | |
bin | 88 | 62.5 | 100 | 88 | |
c8.js | 88 | 62.5 | 100 | 88 | 36,40,47,48,49,50 |
lib | 95.93 | 60 | 100 | 95.93 | |
lib | 95.59 | 61.29 | 100 | 95.59 | |
parse-args.js | 97.59 | 44.44 | 100 | 97.59 | 59,60 |
report.js | 94.93 | 66.67 | 100 | 94.93 |... 99,100,123,124 |
test/fixtures | 95.16 | 94.12 | 0 | 95.16 | |
report.js | 94.44 | 68.18 | 100 | 94.44 |... 01,127,128,129 |
test/fixtures | 95.16 | 94.12 | 85.71 | 95.16 | |
async.js | 100 | 100 | 100 | 100 | |
multiple-spawn.js | 100 | 100 | 100 | 100 | |
normal.js | 85.71 | 75 | 0 | 85.71 | 14,15,16 |
normal.js | 85.71 | 75 | 50 | 85.71 | 14,15,16 |
subprocess.js | 100 | 100 | 100 | 100 | |
--------------------|----------|----------|----------|----------|-------------------|
,"
Expand All @@ -35,9 +35,9 @@ hey
-----------|----------|----------|----------|----------|-------------------|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
-----------|----------|----------|----------|----------|-------------------|
All files | 91.18 | 88.89 | 0 | 91.18 | |
All files | 91.18 | 88.89 | 80 | 91.18 | |
async.js | 100 | 100 | 100 | 100 | |
normal.js | 85.71 | 75 | 0 | 85.71 | 14,15,16 |
normal.js | 85.71 | 75 | 50 | 85.71 | 14,15,16 |
-----------|----------|----------|----------|----------|-------------------|
,"
`;

0 comments on commit 1de0cca

Please sign in to comment.