v8-to-istanbul
Advanced tools
Comparing version 2.0.2 to 2.0.3
@@ -5,2 +5,6 @@ # Change Log | ||
## [2.0.3](https://github.com/bcoe/v8-to-istanbul/compare/v2.0.2...v2.0.3) (2019-04-07) | ||
<a name="2.0.2"></a> | ||
@@ -7,0 +11,0 @@ ## [2.0.2](https://github.com/bcoe/v8-to-istanbul/compare/v2.0.1...v2.0.2) (2019-01-20) |
@@ -20,2 +20,3 @@ const assert = require('assert') | ||
this.wrapperLength = wrapperLength === undefined ? cjsWrapperLength : wrapperLength | ||
this.wrapperLength -= shebangLength(source) | ||
this.lines = [] | ||
@@ -138,4 +139,15 @@ this.branches = [] | ||
function shebangLength (source) { | ||
if (source.indexOf('#!') === 0) { | ||
const match = source.match(/(?<shebang>#!.*)/) | ||
if (match) { | ||
return match.groups.shebang.length | ||
} | ||
} else { | ||
return 0 | ||
} | ||
} | ||
function parsePath (scriptPath) { | ||
return scriptPath.replace('file://', '') | ||
} |
{ | ||
"name": "v8-to-istanbul", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"description": "convert from v8 coverage format to istanbul's format", | ||
@@ -8,3 +8,3 @@ "main": "index.js", | ||
"snapshot": "TAP_SNAPSHOT=1 tap test/*.js", | ||
"test": "c8 --reporter=html --reporter=text tap test/*.js", | ||
"test": "c8 --reporter=html --reporter=text tap --no-esm test/*.js", | ||
"posttest": "standard", | ||
@@ -30,8 +30,8 @@ "release": "standard-version", | ||
"devDependencies": { | ||
"c8": "^3.3.0-candidate.2", | ||
"coveralls": "^3.0.2", | ||
"c8": "^3.4.0", | ||
"coveralls": "^3.0.3", | ||
"should": "^13.2.3", | ||
"standard": "^12.0.1", | ||
"standard-version": "^4.4.0", | ||
"tap": "^12.0.1" | ||
"standard-version": "^5.0.2", | ||
"tap": "^12.6.1" | ||
}, | ||
@@ -38,0 +38,0 @@ "engines": { |
@@ -44,8 +44,1 @@ # v8-to-istanbul | ||
``` | ||
To output istanbul coverage data while running tests (useful as you add | ||
new assertions), simply run: | ||
```bash | ||
DEBUG=true npm test | ||
``` |
@@ -528,1 +528,56 @@ /* IMPORTANT | ||
` | ||
exports[`test/script.js TAP > undefined 3`] = ` | ||
{ path: './test/fixtures/scripts/shebang.js', | ||
statementMap: | ||
{ '0': | ||
{ start: { line: 1, column: 0 }, end: { line: 1, column: 19 } }, | ||
'1': | ||
{ start: { line: 2, column: 0 }, end: { line: 2, column: 12 } }, | ||
'2': | ||
{ start: { line: 3, column: 0 }, end: { line: 3, column: 0 } }, | ||
'3': | ||
{ start: { line: 4, column: 0 }, end: { line: 4, column: 19 } }, | ||
'4': | ||
{ start: { line: 5, column: 0 }, end: { line: 5, column: 25 } }, | ||
'5': | ||
{ start: { line: 6, column: 0 }, end: { line: 6, column: 1 } }, | ||
'6': | ||
{ start: { line: 7, column: 0 }, end: { line: 7, column: 0 } }, | ||
'7': | ||
{ start: { line: 8, column: 0 }, end: { line: 8, column: 7 } } }, | ||
s: | ||
{ '0': 1, '1': 1, '2': 1, '3': 1, '4': 1, '5': 1, '6': 1, '7': 1 }, | ||
branchMap: | ||
{ '0': | ||
{ type: 'branch', | ||
line: undefined, | ||
loc: | ||
{ start: { line: 1, column: 0 }, end: { line: 8, column: 7 } }, | ||
locations: | ||
[ { start: { line: 1, column: 0 }, end: { line: 8, column: 7 } } ] }, | ||
'1': | ||
{ type: 'branch', | ||
line: undefined, | ||
loc: | ||
{ start: { line: 1, column: 0 }, end: { line: 8, column: 7 } }, | ||
locations: | ||
[ { start: { line: 1, column: 0 }, end: { line: 8, column: 7 } } ] }, | ||
'2': | ||
{ type: 'branch', | ||
line: undefined, | ||
loc: | ||
{ start: { line: 4, column: 0 }, end: { line: 6, column: 1 } }, | ||
locations: | ||
[ { start: { line: 4, column: 0 }, end: { line: 6, column: 1 } } ] } }, | ||
b: { '0': [ 1 ], '1': [ 1 ], '2': [ 1 ] }, | ||
fnMap: | ||
{ '0': | ||
{ name: 'hello', | ||
decl: | ||
{ start: { line: 4, column: 0 }, end: { line: 6, column: 1 } }, | ||
loc: | ||
{ start: { line: 4, column: 0 }, end: { line: 6, column: 1 } }, | ||
line: 4 } }, | ||
f: { '0': 1 } } | ||
` |
@@ -71,17 +71,3 @@ module.exports = { | ||
] | ||
}, | ||
assertions: [ | ||
{ | ||
describe: 'basic binary operation', | ||
branches: [ | ||
{ | ||
startLine: 2, | ||
startCol: 13, | ||
endLine: 2, | ||
endCol: 18, | ||
count: 0 | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} |
@@ -122,69 +122,3 @@ module.exports = { | ||
] | ||
}, | ||
assertions: [ | ||
{ | ||
describe: 'function that is not executed', | ||
lines: [ | ||
{ | ||
start: 2, | ||
end: 6, | ||
count: 0 | ||
} | ||
] | ||
}, | ||
{ | ||
describe: 'function that is called once', | ||
lines: [ | ||
{ | ||
startLine: 9, | ||
endLine: 14, | ||
count: 1 | ||
} | ||
], | ||
branches: [ | ||
{ | ||
startLine: 10, | ||
startCol: 28, | ||
endLine: 10, | ||
endCol: 37, | ||
count: 0 | ||
} | ||
] | ||
}, | ||
{ | ||
describe: "function that's called multiple times", | ||
lines: [ | ||
{ | ||
startLine: 20, | ||
endLine: 22, | ||
count: 2 | ||
} | ||
] | ||
}, | ||
{ | ||
describe: 'class that never has member functions called', | ||
lines: [ | ||
{ | ||
startLine: 30, | ||
endLine: 30, | ||
count: 0 | ||
}, | ||
{ | ||
startLine: 33, | ||
endLine: 33, | ||
count: 0 | ||
} | ||
] | ||
}, | ||
{ | ||
describe: 'class that has member functions called', | ||
lines: [ | ||
{ | ||
startLine: 38, | ||
endLine: 45, | ||
count: 1 | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} |
36775
19
1169
44