Socket
Socket
Sign inDemoInstall

v8-to-istanbul

Package Overview
Dependencies
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

v8-to-istanbul - npm Package Compare versions

Comparing version 3.0.1 to 3.1.0

9

CHANGELOG.md

@@ -5,2 +5,11 @@ # Change Log

# [3.1.0](https://github.com/bcoe/v8-to-istanbul/compare/v3.0.1...v3.1.0) (2019-05-02)
### Features
* allow uncovered lines to be ignored with special comment ([#23](https://github.com/bcoe/v8-to-istanbul/issues/23)) ([f585cfa](https://github.com/bcoe/v8-to-istanbul/commit/f585cfa))
## [3.0.1](https://github.com/bcoe/v8-to-istanbul/compare/v3.0.0...v3.0.1) (2019-05-01)

@@ -7,0 +16,0 @@

3

lib/line.js

@@ -17,2 +17,5 @@ module.exports = class CovLine {

this.count = 1
// set by source.js during parsing, if /* c8 ignore next */ is found.
this.ignore = false
}

@@ -19,0 +22,0 @@ toIstanbul () {

@@ -15,7 +15,31 @@ const CovLine = require('./line')

let position = 0
let ignoreCount = 0
for (const [i, lineStr] of source.split(/(?<=\r?\n)/u).entries()) {
this.lines.push(new CovLine(i + 1, position, lineStr))
const line = new CovLine(i + 1, position, lineStr)
if (ignoreCount > 0) {
line.ignore = true
ignoreCount--
} else {
ignoreCount = this._parseIgnoreNext(lineStr, line)
}
this.lines.push(line)
position += lineStr.length
}
}
_parseIgnoreNext (lineStr, line) {
const testIgnoreNextLines = lineStr.match(/^\W*\/\* c8 ignore next (?<count>[0-9]+)? *\*\/\W*$/)
if (testIgnoreNextLines) {
if (testIgnoreNextLines.groups['count']) {
return Number(testIgnoreNextLines.groups['count'])
} else {
return 1
}
} else {
if (lineStr.match(/\/\* c8 ignore next \*\//)) {
line.ignore = true
}
}
return 0
}
// given a start column and end column in absolute offsets within

@@ -22,0 +46,0 @@ // a source file (0 - EOF), returns the relative line column positions.

9

lib/v8-to-istanbul.js

@@ -105,6 +105,9 @@ const { relativeTo } = require('./pathutils')

// 0 for line coverage.
if (startCol <= line.startCol && endCol >= line.endCol) {
//
// All lines start out with coverage of 1, and are later set to 0
// if they are not invoked; line.ignore prevents a line from being
// set to 0, and is set if the special comment /* c8 ignore next */
// is used.
if (startCol <= line.startCol && endCol >= line.endCol && !line.ignore) {
line.count = range.count
} else {
// console.info(`${line.line} count: ${range.count}`)
}

@@ -111,0 +114,0 @@ })

{
"name": "v8-to-istanbul",
"version": "3.0.1",
"version": "3.1.0",
"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 --no-esm test/*.js",
"test": "c8 --reporter=html --reporter=text tap --no-coverage --no-esm test/*.js",
"posttest": "standard",

@@ -30,3 +30,3 @@ "release": "standard-version",

"devDependencies": {
"c8": "^3.5.0",
"c8": "^4.0.0",
"coveralls": "^3.0.3",

@@ -37,3 +37,3 @@ "should": "^13.2.3",

"standard-version": "^5.0.2",
"tap": "^12.6.2"
"tap": "^13.1.2"
},

@@ -40,0 +40,0 @@ "engines": {

@@ -37,2 +37,35 @@ # v8-to-istanbul

## Ignoring Uncovered Lines
Sometimes you might find yourself wanting to ignore uncovered lines
in your application (for example, perhaps you run your tests in Linux, but
there's code that only executes on Windows).
To ignore lines, use the special comment `/* c8 ignore next */`.
### ignoring the next line
```js
const myVariable = 99
/* c8 ignore next */
if (process.platform === 'win32') console.info('hello world')
```
### ignoring the next N lines
```js
const myVariable = 99
/* c8 ignore next 3 */
if (process.platform === 'win32') {
console.info('hello world')
}
```
### ignoring the same line as the comment
```js
const myVariable = 99
const os = process.platform === 'darwin' ? 'OSXy' /* c8 ignore next */ : 'Windowsy'
```
## Testing

@@ -39,0 +72,0 @@

@@ -8,801 +8,2570 @@ /* IMPORTANT

'use strict'
exports[`test/v8-to-istanbul.js TAP > undefined 1`] = `
{ path: './test/fixtures/scripts/branches.js',
statementMap:
{ '0':
{ start: { line: 1, column: 0 }, end: { line: 1, column: 26 } },
'1':
{ start: { line: 2, column: 0 }, end: { line: 2, column: 18 } },
'2':
{ start: { line: 3, column: 0 }, end: { line: 3, column: 0 } },
'3':
{ start: { line: 4, column: 0 }, end: { line: 4, column: 31 } },
'4':
{ start: { line: 5, column: 0 }, end: { line: 5, column: 37 } },
'5':
{ start: { line: 6, column: 0 }, end: { line: 6, column: 0 } },
'6':
{ start: { line: 7, column: 0 }, end: { line: 7, column: 18 } },
'7':
{ start: { line: 8, column: 0 }, end: { line: 8, column: 31 } },
'8':
{ start: { line: 9, column: 0 }, end: { line: 9, column: 0 } },
'9':
{ start: { line: 10, column: 0 },
end: { line: 10, column: 16 } },
'10':
{ start: { line: 11, column: 0 },
end: { line: 11, column: 12 } },
'11':
{ start: { line: 12, column: 0 },
end: { line: 12, column: 14 } },
'12':
{ start: { line: 13, column: 0 }, end: { line: 13, column: 1 } },
'13':
{ start: { line: 14, column: 0 }, end: { line: 14, column: 8 } },
'14':
{ start: { line: 15, column: 0 },
end: { line: 15, column: 25 } },
'15':
{ start: { line: 16, column: 0 }, end: { line: 16, column: 3 } },
'16':
{ start: { line: 17, column: 0 }, end: { line: 17, column: 0 } },
'17':
{ start: { line: 18, column: 0 },
end: { line: 18, column: 28 } },
'18':
{ start: { line: 19, column: 0 },
end: { line: 19, column: 15 } },
'19':
{ start: { line: 20, column: 0 },
end: { line: 20, column: 13 } },
'20':
{ start: { line: 21, column: 0 },
end: { line: 21, column: 23 } },
'21':
{ start: { line: 22, column: 0 },
end: { line: 22, column: 10 } },
'22':
{ start: { line: 23, column: 0 },
end: { line: 23, column: 16 } },
'23':
{ start: { line: 24, column: 0 }, end: { line: 24, column: 3 } },
'24':
{ start: { line: 25, column: 0 }, end: { line: 25, column: 1 } },
'25':
{ start: { line: 26, column: 0 }, end: { line: 26, column: 0 } },
'26':
{ start: { line: 27, column: 0 }, end: { line: 27, column: 3 } },
'27':
{ start: { line: 28, column: 0 }, end: { line: 28, column: 0 } },
'28':
{ start: { line: 29, column: 0 },
end: { line: 29, column: 46 } },
'29':
{ start: { line: 30, column: 0 },
end: { line: 30, column: 15 } },
'30':
{ start: { line: 31, column: 0 },
end: { line: 31, column: 10 } } },
s:
{ '0': 1,
'1': 1,
'2': 1,
'3': 1,
'4': 1,
'5': 1,
'6': 1,
'7': 1,
'8': 1,
'9': 1,
'10': 1,
'11': 1,
'12': 1,
'13': 1,
'14': 1,
'15': 1,
'16': 1,
'17': 1,
'18': 1,
'19': 1,
'20': 1,
'21': 1,
'22': 1,
'23': 1,
'24': 1,
'25': 1,
'26': 1,
'27': 1,
'28': 1,
'29': 1,
'30': 1 },
branchMap:
{ '0':
{ type: 'branch',
line: 1,
loc:
{ start: { line: 1, column: 0 }, end: { line: 31, column: 10 } },
locations:
[ { start: { line: 1, column: 0 }, end: { line: 31, column: 10 } } ] },
'1':
{ type: 'branch',
line: 1,
loc:
{ start: { line: 1, column: 1 }, end: { line: 31, column: 10 } },
locations:
[ { start: { line: 1, column: 1 }, end: { line: 31, column: 10 } } ] },
'2':
{ type: 'branch',
line: 5,
loc:
{ start: { line: 5, column: 23 }, end: { line: 5, column: 28 } },
locations:
[ { start: { line: 5, column: 23 }, end: { line: 5, column: 28 } } ] },
'3':
{ type: 'branch',
line: 8,
loc:
{ start: { line: 8, column: 22 }, end: { line: 8, column: 29 } },
locations:
[ { start: { line: 8, column: 22 }, end: { line: 8, column: 29 } } ] },
'4':
{ type: 'branch',
line: 14,
loc:
{ start: { line: 14, column: 8 }, end: { line: 15, column: 4 } },
locations:
[ { start: { line: 14, column: 8 }, end: { line: 15, column: 4 } } ] },
'5':
{ type: 'branch',
line: 18,
loc:
{ start: { line: 18, column: 3 },
end: { line: 18, column: 21 } },
locations:
[ { start: { line: 18, column: 3 },
end: { line: 18, column: 21 } } ] },
'6':
{ type: 'branch',
line: 22,
loc:
{ start: { line: 22, column: 8 }, end: { line: 30, column: 8 } },
locations:
[ { start: { line: 22, column: 8 }, end: { line: 30, column: 8 } } ] },
'7':
{ type: 'branch',
line: 29,
loc:
{ start: { line: 29, column: 31 },
end: { line: 30, column: 6 } },
locations:
[ { start: { line: 29, column: 31 },
end: { line: 30, column: 6 } } ] } },
b:
{ '0': [ 1 ],
'1': [ 1 ],
'2': [ 0 ],
'3': [ 0 ],
'4': [ 0 ],
'5': [ 0 ],
'6': [ 1 ],
'7': [ 0 ] },
fnMap:
{ '0':
{ name: 'e',
decl:
{ start: { line: 22, column: 8 }, end: { line: 30, column: 8 } },
loc:
{ start: { line: 22, column: 8 }, end: { line: 30, column: 8 } },
line: 22 } },
f: { '0': 1 } }
exports[`test/v8-to-istanbul.js TAP > must match snapshot 1`] = `
Object {
"path": "./test/fixtures/scripts/branches.js",
"statementMap": Object {
"0": Object {
"start": Object {
"line": 1,
"column": 0,
},
"end": Object {
"line": 1,
"column": 26,
},
},
"1": Object {
"start": Object {
"line": 2,
"column": 0,
},
"end": Object {
"line": 2,
"column": 18,
},
},
"2": Object {
"start": Object {
"line": 3,
"column": 0,
},
"end": Object {
"line": 3,
"column": 0,
},
},
"3": Object {
"start": Object {
"line": 4,
"column": 0,
},
"end": Object {
"line": 4,
"column": 31,
},
},
"4": Object {
"start": Object {
"line": 5,
"column": 0,
},
"end": Object {
"line": 5,
"column": 37,
},
},
"5": Object {
"start": Object {
"line": 6,
"column": 0,
},
"end": Object {
"line": 6,
"column": 0,
},
},
"6": Object {
"start": Object {
"line": 7,
"column": 0,
},
"end": Object {
"line": 7,
"column": 18,
},
},
"7": Object {
"start": Object {
"line": 8,
"column": 0,
},
"end": Object {
"line": 8,
"column": 31,
},
},
"8": Object {
"start": Object {
"line": 9,
"column": 0,
},
"end": Object {
"line": 9,
"column": 0,
},
},
"9": Object {
"start": Object {
"line": 10,
"column": 0,
},
"end": Object {
"line": 10,
"column": 16,
},
},
"10": Object {
"start": Object {
"line": 11,
"column": 0,
},
"end": Object {
"line": 11,
"column": 12,
},
},
"11": Object {
"start": Object {
"line": 12,
"column": 0,
},
"end": Object {
"line": 12,
"column": 14,
},
},
"12": Object {
"start": Object {
"line": 13,
"column": 0,
},
"end": Object {
"line": 13,
"column": 1,
},
},
"13": Object {
"start": Object {
"line": 14,
"column": 0,
},
"end": Object {
"line": 14,
"column": 8,
},
},
"14": Object {
"start": Object {
"line": 15,
"column": 0,
},
"end": Object {
"line": 15,
"column": 25,
},
},
"15": Object {
"start": Object {
"line": 16,
"column": 0,
},
"end": Object {
"line": 16,
"column": 3,
},
},
"16": Object {
"start": Object {
"line": 17,
"column": 0,
},
"end": Object {
"line": 17,
"column": 0,
},
},
"17": Object {
"start": Object {
"line": 18,
"column": 0,
},
"end": Object {
"line": 18,
"column": 28,
},
},
"18": Object {
"start": Object {
"line": 19,
"column": 0,
},
"end": Object {
"line": 19,
"column": 15,
},
},
"19": Object {
"start": Object {
"line": 20,
"column": 0,
},
"end": Object {
"line": 20,
"column": 13,
},
},
"20": Object {
"start": Object {
"line": 21,
"column": 0,
},
"end": Object {
"line": 21,
"column": 23,
},
},
"21": Object {
"start": Object {
"line": 22,
"column": 0,
},
"end": Object {
"line": 22,
"column": 10,
},
},
"22": Object {
"start": Object {
"line": 23,
"column": 0,
},
"end": Object {
"line": 23,
"column": 16,
},
},
"23": Object {
"start": Object {
"line": 24,
"column": 0,
},
"end": Object {
"line": 24,
"column": 3,
},
},
"24": Object {
"start": Object {
"line": 25,
"column": 0,
},
"end": Object {
"line": 25,
"column": 1,
},
},
"25": Object {
"start": Object {
"line": 26,
"column": 0,
},
"end": Object {
"line": 26,
"column": 0,
},
},
"26": Object {
"start": Object {
"line": 27,
"column": 0,
},
"end": Object {
"line": 27,
"column": 3,
},
},
"27": Object {
"start": Object {
"line": 28,
"column": 0,
},
"end": Object {
"line": 28,
"column": 0,
},
},
"28": Object {
"start": Object {
"line": 29,
"column": 0,
},
"end": Object {
"line": 29,
"column": 46,
},
},
"29": Object {
"start": Object {
"line": 30,
"column": 0,
},
"end": Object {
"line": 30,
"column": 15,
},
},
"30": Object {
"start": Object {
"line": 31,
"column": 0,
},
"end": Object {
"line": 31,
"column": 10,
},
},
},
"s": Object {
"0": 1,
"1": 1,
"2": 1,
"3": 1,
"4": 1,
"5": 1,
"6": 1,
"7": 1,
"8": 1,
"9": 1,
"10": 1,
"11": 1,
"12": 1,
"13": 1,
"14": 1,
"15": 1,
"16": 1,
"17": 1,
"18": 1,
"19": 1,
"20": 1,
"21": 1,
"22": 1,
"23": 1,
"24": 1,
"25": 1,
"26": 1,
"27": 1,
"28": 1,
"29": 1,
"30": 1,
},
"branchMap": Object {
"0": Object {
"type": "branch",
"line": 1,
"loc": Object {
"start": Object {
"line": 1,
"column": 0,
},
"end": Object {
"line": 31,
"column": 10,
},
},
"locations": Array [
Object {
"start": Object {
"line": 1,
"column": 0,
},
"end": Object {
"line": 31,
"column": 10,
},
},
],
},
"1": Object {
"type": "branch",
"line": 1,
"loc": Object {
"start": Object {
"line": 1,
"column": 1,
},
"end": Object {
"line": 31,
"column": 10,
},
},
"locations": Array [
Object {
"start": Object {
"line": 1,
"column": 1,
},
"end": Object {
"line": 31,
"column": 10,
},
},
],
},
"2": Object {
"type": "branch",
"line": 5,
"loc": Object {
"start": Object {
"line": 5,
"column": 23,
},
"end": Object {
"line": 5,
"column": 28,
},
},
"locations": Array [
Object {
"start": Object {
"line": 5,
"column": 23,
},
"end": Object {
"line": 5,
"column": 28,
},
},
],
},
"3": Object {
"type": "branch",
"line": 8,
"loc": Object {
"start": Object {
"line": 8,
"column": 22,
},
"end": Object {
"line": 8,
"column": 29,
},
},
"locations": Array [
Object {
"start": Object {
"line": 8,
"column": 22,
},
"end": Object {
"line": 8,
"column": 29,
},
},
],
},
"4": Object {
"type": "branch",
"line": 14,
"loc": Object {
"start": Object {
"line": 14,
"column": 8,
},
"end": Object {
"line": 15,
"column": 4,
},
},
"locations": Array [
Object {
"start": Object {
"line": 14,
"column": 8,
},
"end": Object {
"line": 15,
"column": 4,
},
},
],
},
"5": Object {
"type": "branch",
"line": 18,
"loc": Object {
"start": Object {
"line": 18,
"column": 3,
},
"end": Object {
"line": 18,
"column": 21,
},
},
"locations": Array [
Object {
"start": Object {
"line": 18,
"column": 3,
},
"end": Object {
"line": 18,
"column": 21,
},
},
],
},
"6": Object {
"type": "branch",
"line": 22,
"loc": Object {
"start": Object {
"line": 22,
"column": 8,
},
"end": Object {
"line": 30,
"column": 8,
},
},
"locations": Array [
Object {
"start": Object {
"line": 22,
"column": 8,
},
"end": Object {
"line": 30,
"column": 8,
},
},
],
},
"7": Object {
"type": "branch",
"line": 29,
"loc": Object {
"start": Object {
"line": 29,
"column": 31,
},
"end": Object {
"line": 30,
"column": 6,
},
},
"locations": Array [
Object {
"start": Object {
"line": 29,
"column": 31,
},
"end": Object {
"line": 30,
"column": 6,
},
},
],
},
},
"b": Object {
"0": Array [
1,
],
"1": Array [
1,
],
"2": Array [
0,
],
"3": Array [
0,
],
"4": Array [
0,
],
"5": Array [
0,
],
"6": Array [
1,
],
"7": Array [
0,
],
},
"fnMap": Object {
"0": Object {
"name": "e",
"decl": Object {
"start": Object {
"line": 22,
"column": 8,
},
"end": Object {
"line": 30,
"column": 8,
},
},
"loc": Object {
"start": Object {
"line": 22,
"column": 8,
},
"end": Object {
"line": 30,
"column": 8,
},
},
"line": 22,
},
},
"f": Object {
"0": 1,
},
}
`
exports[`test/v8-to-istanbul.js TAP > undefined 2`] = `
{ path: './test/fixtures/scripts/functions.js',
statementMap:
{ '0':
{ start: { line: 1, column: 0 }, end: { line: 1, column: 30 } },
'1':
{ start: { line: 2, column: 0 }, end: { line: 2, column: 14 } },
'2':
{ start: { line: 3, column: 0 }, end: { line: 3, column: 16 } },
'3':
{ start: { line: 4, column: 0 }, end: { line: 4, column: 31 } },
'4':
{ start: { line: 5, column: 0 }, end: { line: 5, column: 3 } },
'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: 31 } },
'8':
{ start: { line: 9, column: 0 }, end: { line: 9, column: 17 } },
'9':
{ start: { line: 10, column: 0 },
end: { line: 10, column: 37 } },
'10':
{ start: { line: 11, column: 0 },
end: { line: 11, column: 21 } },
'11':
{ start: { line: 12, column: 0 },
end: { line: 12, column: 23 } },
'12':
{ start: { line: 13, column: 0 },
end: { line: 13, column: 13 } },
'13':
{ start: { line: 14, column: 0 }, end: { line: 14, column: 3 } },
'14':
{ start: { line: 15, column: 0 }, end: { line: 15, column: 0 } },
'15':
{ start: { line: 16, column: 0 }, end: { line: 16, column: 3 } },
'16':
{ start: { line: 17, column: 0 }, end: { line: 17, column: 0 } },
'17':
{ start: { line: 18, column: 0 },
end: { line: 18, column: 41 } },
'18':
{ start: { line: 19, column: 0 },
end: { line: 19, column: 17 } },
'19':
{ start: { line: 20, column: 0 },
end: { line: 20, column: 14 } },
'20':
{ start: { line: 21, column: 0 },
end: { line: 21, column: 17 } },
'21':
{ start: { line: 22, column: 0 }, end: { line: 22, column: 6 } },
'22':
{ start: { line: 23, column: 0 }, end: { line: 23, column: 1 } },
'23':
{ start: { line: 24, column: 0 }, end: { line: 24, column: 0 } },
'24':
{ start: { line: 25, column: 0 }, end: { line: 25, column: 8 } },
'25':
{ start: { line: 26, column: 0 }, end: { line: 26, column: 0 } },
'26':
{ start: { line: 27, column: 0 },
end: { line: 27, column: 48 } },
'27':
{ start: { line: 28, column: 0 },
end: { line: 28, column: 11 } },
'28':
{ start: { line: 29, column: 0 },
end: { line: 29, column: 18 } },
'29':
{ start: { line: 30, column: 0 },
end: { line: 30, column: 18 } },
'30':
{ start: { line: 31, column: 0 }, end: { line: 31, column: 3 } },
'31':
{ start: { line: 32, column: 0 },
end: { line: 32, column: 12 } },
'32':
{ start: { line: 33, column: 0 },
end: { line: 33, column: 25 } },
'33':
{ start: { line: 34, column: 0 }, end: { line: 34, column: 3 } },
'34':
{ start: { line: 35, column: 0 }, end: { line: 35, column: 1 } },
'35':
{ start: { line: 36, column: 0 }, end: { line: 36, column: 0 } },
'36':
{ start: { line: 37, column: 0 },
end: { line: 37, column: 42 } },
'37':
{ start: { line: 38, column: 0 },
end: { line: 38, column: 13 } },
'38':
{ start: { line: 39, column: 0 },
end: { line: 39, column: 20 } },
'39':
{ start: { line: 40, column: 0 },
end: { line: 40, column: 20 } },
'40':
{ start: { line: 41, column: 0 }, end: { line: 41, column: 5 } },
'41':
{ start: { line: 42, column: 0 },
end: { line: 42, column: 14 } },
'42':
{ start: { line: 43, column: 0 },
end: { line: 43, column: 40 } },
'43':
{ start: { line: 44, column: 0 }, end: { line: 44, column: 5 } },
'44':
{ start: { line: 45, column: 0 }, end: { line: 45, column: 3 } },
'45':
{ start: { line: 46, column: 0 }, end: { line: 46, column: 0 } },
'46':
{ start: { line: 47, column: 0 },
end: { line: 47, column: 19 } },
'47':
{ start: { line: 48, column: 0 }, end: { line: 48, column: 9 } } },
s:
{ '0': 1,
'1': 1,
'2': 1,
'3': 1,
'4': 0,
'5': 0,
'6': 0,
'7': 0,
'8': 0,
'9': 1,
'10': 1,
'11': 1,
'12': 1,
'13': 1,
'14': 1,
'15': 1,
'16': 1,
'17': 1,
'18': 1,
'19': 1,
'20': 1,
'21': 1,
'22': 1,
'23': 1,
'24': 1,
'25': 1,
'26': 1,
'27': 1,
'28': 1,
'29': 1,
'30': 1,
'31': 1,
'32': 1,
'33': 0,
'34': 0,
'35': 0,
'36': 1,
'37': 0,
'38': 1,
'39': 1,
'40': 1,
'41': 1,
'42': 1,
'43': 1,
'44': 1,
'45': 1,
'46': 1,
'47': 1 },
branchMap:
{ '0':
{ type: 'branch',
line: 1,
loc:
{ start: { line: 1, column: 0 }, end: { line: 48, column: 9 } },
locations:
[ { start: { line: 1, column: 0 }, end: { line: 48, column: 9 } } ] },
'1':
{ type: 'branch',
line: 1,
loc:
{ start: { line: 1, column: 1 }, end: { line: 48, column: 9 } },
locations:
[ { start: { line: 1, column: 1 }, end: { line: 48, column: 9 } } ] },
'2':
{ type: 'branch',
line: 11,
loc:
{ start: { line: 11, column: 8 },
end: { line: 19, column: 13 } },
locations:
[ { start: { line: 11, column: 8 },
end: { line: 19, column: 13 } } ] },
'3':
{ type: 'branch',
line: 13,
loc:
{ start: { line: 13, column: 6 }, end: { line: 14, column: 1 } },
locations:
[ { start: { line: 13, column: 6 }, end: { line: 14, column: 1 } } ] },
'4':
{ type: 'branch',
line: 18,
loc:
{ start: { line: 18, column: 32 },
end: { line: 18, column: 37 } },
locations:
[ { start: { line: 18, column: 32 },
end: { line: 18, column: 37 } } ] },
'5':
{ type: 'branch',
line: 19,
loc:
{ start: { line: 19, column: 9 },
end: { line: 19, column: 12 } },
locations:
[ { start: { line: 19, column: 9 },
end: { line: 19, column: 12 } } ] },
'6':
{ type: 'branch',
line: 27,
loc:
{ start: { line: 27, column: 1 }, end: { line: 28, column: 1 } },
locations:
[ { start: { line: 27, column: 1 }, end: { line: 28, column: 1 } } ] },
'7':
{ type: 'branch',
line: 43,
loc:
{ start: { line: 43, column: 15 },
end: { line: 44, column: 5 } },
locations:
[ { start: { line: 43, column: 15 },
end: { line: 44, column: 5 } } ] },
'8':
{ type: 'branch',
line: 47,
loc:
{ start: { line: 47, column: 5 }, end: { line: 48, column: 9 } },
locations:
[ { start: { line: 47, column: 5 }, end: { line: 48, column: 9 } } ] } },
b:
{ '0': [ 1 ],
'1': [ 1 ],
'2': [ 1 ],
'3': [ 0 ],
'4': [ 0 ],
'5': [ 0 ],
'6': [ 2 ],
'7': [ 1 ],
'8': [ 1 ] },
fnMap:
{ '0':
{ name: 'a',
decl:
{ start: { line: 4, column: 30 },
end: { line: 10, column: 10 } },
loc:
{ start: { line: 4, column: 30 },
end: { line: 10, column: 10 } },
line: 4 },
'1':
{ name: 'b',
decl:
{ start: { line: 11, column: 8 },
end: { line: 19, column: 13 } },
loc:
{ start: { line: 11, column: 8 },
end: { line: 19, column: 13 } },
line: 11 },
'2':
{ name: 'c',
decl:
{ start: { line: 27, column: 1 }, end: { line: 28, column: 1 } },
loc:
{ start: { line: 27, column: 1 }, end: { line: 28, column: 1 } },
line: 27 },
'3':
{ name: 'Foo',
decl:
{ start: { line: 33, column: 21 },
end: { line: 37, column: 15 } },
loc:
{ start: { line: 33, column: 21 },
end: { line: 37, column: 15 } },
line: 33 },
'4':
{ name: 'hello',
decl:
{ start: { line: 37, column: 24 },
end: { line: 39, column: 1 } },
loc:
{ start: { line: 37, column: 24 },
end: { line: 39, column: 1 } },
line: 37 },
'5':
{ name: 'Bar',
decl:
{ start: { line: 43, column: 15 },
end: { line: 44, column: 5 } },
loc:
{ start: { line: 43, column: 15 },
end: { line: 44, column: 5 } },
line: 43 },
'6':
{ name: 'hello',
decl:
{ start: { line: 47, column: 5 }, end: { line: 48, column: 9 } },
loc:
{ start: { line: 47, column: 5 }, end: { line: 48, column: 9 } },
line: 47 } },
f: { '0': 0, '1': 1, '2': 2, '3': 0, '4': 0, '5': 1, '6': 1 } }
exports[`test/v8-to-istanbul.js TAP > must match snapshot 2`] = `
Object {
"path": "./test/fixtures/scripts/functions.js",
"statementMap": Object {
"0": Object {
"start": Object {
"line": 1,
"column": 0,
},
"end": Object {
"line": 1,
"column": 30,
},
},
"1": Object {
"start": Object {
"line": 2,
"column": 0,
},
"end": Object {
"line": 2,
"column": 14,
},
},
"2": Object {
"start": Object {
"line": 3,
"column": 0,
},
"end": Object {
"line": 3,
"column": 16,
},
},
"3": Object {
"start": Object {
"line": 4,
"column": 0,
},
"end": Object {
"line": 4,
"column": 31,
},
},
"4": Object {
"start": Object {
"line": 5,
"column": 0,
},
"end": Object {
"line": 5,
"column": 3,
},
},
"5": Object {
"start": Object {
"line": 6,
"column": 0,
},
"end": Object {
"line": 6,
"column": 1,
},
},
"6": Object {
"start": Object {
"line": 7,
"column": 0,
},
"end": Object {
"line": 7,
"column": 0,
},
},
"7": Object {
"start": Object {
"line": 8,
"column": 0,
},
"end": Object {
"line": 8,
"column": 31,
},
},
"8": Object {
"start": Object {
"line": 9,
"column": 0,
},
"end": Object {
"line": 9,
"column": 17,
},
},
"9": Object {
"start": Object {
"line": 10,
"column": 0,
},
"end": Object {
"line": 10,
"column": 37,
},
},
"10": Object {
"start": Object {
"line": 11,
"column": 0,
},
"end": Object {
"line": 11,
"column": 21,
},
},
"11": Object {
"start": Object {
"line": 12,
"column": 0,
},
"end": Object {
"line": 12,
"column": 23,
},
},
"12": Object {
"start": Object {
"line": 13,
"column": 0,
},
"end": Object {
"line": 13,
"column": 13,
},
},
"13": Object {
"start": Object {
"line": 14,
"column": 0,
},
"end": Object {
"line": 14,
"column": 3,
},
},
"14": Object {
"start": Object {
"line": 15,
"column": 0,
},
"end": Object {
"line": 15,
"column": 0,
},
},
"15": Object {
"start": Object {
"line": 16,
"column": 0,
},
"end": Object {
"line": 16,
"column": 3,
},
},
"16": Object {
"start": Object {
"line": 17,
"column": 0,
},
"end": Object {
"line": 17,
"column": 0,
},
},
"17": Object {
"start": Object {
"line": 18,
"column": 0,
},
"end": Object {
"line": 18,
"column": 41,
},
},
"18": Object {
"start": Object {
"line": 19,
"column": 0,
},
"end": Object {
"line": 19,
"column": 17,
},
},
"19": Object {
"start": Object {
"line": 20,
"column": 0,
},
"end": Object {
"line": 20,
"column": 14,
},
},
"20": Object {
"start": Object {
"line": 21,
"column": 0,
},
"end": Object {
"line": 21,
"column": 17,
},
},
"21": Object {
"start": Object {
"line": 22,
"column": 0,
},
"end": Object {
"line": 22,
"column": 6,
},
},
"22": Object {
"start": Object {
"line": 23,
"column": 0,
},
"end": Object {
"line": 23,
"column": 1,
},
},
"23": Object {
"start": Object {
"line": 24,
"column": 0,
},
"end": Object {
"line": 24,
"column": 0,
},
},
"24": Object {
"start": Object {
"line": 25,
"column": 0,
},
"end": Object {
"line": 25,
"column": 8,
},
},
"25": Object {
"start": Object {
"line": 26,
"column": 0,
},
"end": Object {
"line": 26,
"column": 0,
},
},
"26": Object {
"start": Object {
"line": 27,
"column": 0,
},
"end": Object {
"line": 27,
"column": 48,
},
},
"27": Object {
"start": Object {
"line": 28,
"column": 0,
},
"end": Object {
"line": 28,
"column": 11,
},
},
"28": Object {
"start": Object {
"line": 29,
"column": 0,
},
"end": Object {
"line": 29,
"column": 18,
},
},
"29": Object {
"start": Object {
"line": 30,
"column": 0,
},
"end": Object {
"line": 30,
"column": 18,
},
},
"30": Object {
"start": Object {
"line": 31,
"column": 0,
},
"end": Object {
"line": 31,
"column": 3,
},
},
"31": Object {
"start": Object {
"line": 32,
"column": 0,
},
"end": Object {
"line": 32,
"column": 12,
},
},
"32": Object {
"start": Object {
"line": 33,
"column": 0,
},
"end": Object {
"line": 33,
"column": 25,
},
},
"33": Object {
"start": Object {
"line": 34,
"column": 0,
},
"end": Object {
"line": 34,
"column": 3,
},
},
"34": Object {
"start": Object {
"line": 35,
"column": 0,
},
"end": Object {
"line": 35,
"column": 1,
},
},
"35": Object {
"start": Object {
"line": 36,
"column": 0,
},
"end": Object {
"line": 36,
"column": 0,
},
},
"36": Object {
"start": Object {
"line": 37,
"column": 0,
},
"end": Object {
"line": 37,
"column": 42,
},
},
"37": Object {
"start": Object {
"line": 38,
"column": 0,
},
"end": Object {
"line": 38,
"column": 13,
},
},
"38": Object {
"start": Object {
"line": 39,
"column": 0,
},
"end": Object {
"line": 39,
"column": 20,
},
},
"39": Object {
"start": Object {
"line": 40,
"column": 0,
},
"end": Object {
"line": 40,
"column": 20,
},
},
"40": Object {
"start": Object {
"line": 41,
"column": 0,
},
"end": Object {
"line": 41,
"column": 5,
},
},
"41": Object {
"start": Object {
"line": 42,
"column": 0,
},
"end": Object {
"line": 42,
"column": 14,
},
},
"42": Object {
"start": Object {
"line": 43,
"column": 0,
},
"end": Object {
"line": 43,
"column": 40,
},
},
"43": Object {
"start": Object {
"line": 44,
"column": 0,
},
"end": Object {
"line": 44,
"column": 5,
},
},
"44": Object {
"start": Object {
"line": 45,
"column": 0,
},
"end": Object {
"line": 45,
"column": 3,
},
},
"45": Object {
"start": Object {
"line": 46,
"column": 0,
},
"end": Object {
"line": 46,
"column": 0,
},
},
"46": Object {
"start": Object {
"line": 47,
"column": 0,
},
"end": Object {
"line": 47,
"column": 19,
},
},
"47": Object {
"start": Object {
"line": 48,
"column": 0,
},
"end": Object {
"line": 48,
"column": 9,
},
},
},
"s": Object {
"0": 1,
"1": 1,
"2": 1,
"3": 1,
"4": 0,
"5": 0,
"6": 0,
"7": 0,
"8": 0,
"9": 1,
"10": 1,
"11": 1,
"12": 1,
"13": 1,
"14": 1,
"15": 1,
"16": 1,
"17": 1,
"18": 1,
"19": 1,
"20": 1,
"21": 1,
"22": 1,
"23": 1,
"24": 1,
"25": 1,
"26": 1,
"27": 1,
"28": 1,
"29": 1,
"30": 1,
"31": 1,
"32": 1,
"33": 0,
"34": 0,
"35": 0,
"36": 1,
"37": 0,
"38": 1,
"39": 1,
"40": 1,
"41": 1,
"42": 1,
"43": 1,
"44": 1,
"45": 1,
"46": 1,
"47": 1,
},
"branchMap": Object {
"0": Object {
"type": "branch",
"line": 1,
"loc": Object {
"start": Object {
"line": 1,
"column": 0,
},
"end": Object {
"line": 48,
"column": 9,
},
},
"locations": Array [
Object {
"start": Object {
"line": 1,
"column": 0,
},
"end": Object {
"line": 48,
"column": 9,
},
},
],
},
"1": Object {
"type": "branch",
"line": 1,
"loc": Object {
"start": Object {
"line": 1,
"column": 1,
},
"end": Object {
"line": 48,
"column": 9,
},
},
"locations": Array [
Object {
"start": Object {
"line": 1,
"column": 1,
},
"end": Object {
"line": 48,
"column": 9,
},
},
],
},
"2": Object {
"type": "branch",
"line": 11,
"loc": Object {
"start": Object {
"line": 11,
"column": 8,
},
"end": Object {
"line": 19,
"column": 13,
},
},
"locations": Array [
Object {
"start": Object {
"line": 11,
"column": 8,
},
"end": Object {
"line": 19,
"column": 13,
},
},
],
},
"3": Object {
"type": "branch",
"line": 13,
"loc": Object {
"start": Object {
"line": 13,
"column": 6,
},
"end": Object {
"line": 14,
"column": 1,
},
},
"locations": Array [
Object {
"start": Object {
"line": 13,
"column": 6,
},
"end": Object {
"line": 14,
"column": 1,
},
},
],
},
"4": Object {
"type": "branch",
"line": 18,
"loc": Object {
"start": Object {
"line": 18,
"column": 32,
},
"end": Object {
"line": 18,
"column": 37,
},
},
"locations": Array [
Object {
"start": Object {
"line": 18,
"column": 32,
},
"end": Object {
"line": 18,
"column": 37,
},
},
],
},
"5": Object {
"type": "branch",
"line": 19,
"loc": Object {
"start": Object {
"line": 19,
"column": 9,
},
"end": Object {
"line": 19,
"column": 12,
},
},
"locations": Array [
Object {
"start": Object {
"line": 19,
"column": 9,
},
"end": Object {
"line": 19,
"column": 12,
},
},
],
},
"6": Object {
"type": "branch",
"line": 27,
"loc": Object {
"start": Object {
"line": 27,
"column": 1,
},
"end": Object {
"line": 28,
"column": 1,
},
},
"locations": Array [
Object {
"start": Object {
"line": 27,
"column": 1,
},
"end": Object {
"line": 28,
"column": 1,
},
},
],
},
"7": Object {
"type": "branch",
"line": 43,
"loc": Object {
"start": Object {
"line": 43,
"column": 15,
},
"end": Object {
"line": 44,
"column": 5,
},
},
"locations": Array [
Object {
"start": Object {
"line": 43,
"column": 15,
},
"end": Object {
"line": 44,
"column": 5,
},
},
],
},
"8": Object {
"type": "branch",
"line": 47,
"loc": Object {
"start": Object {
"line": 47,
"column": 5,
},
"end": Object {
"line": 48,
"column": 9,
},
},
"locations": Array [
Object {
"start": Object {
"line": 47,
"column": 5,
},
"end": Object {
"line": 48,
"column": 9,
},
},
],
},
},
"b": Object {
"0": Array [
1,
],
"1": Array [
1,
],
"2": Array [
1,
],
"3": Array [
0,
],
"4": Array [
0,
],
"5": Array [
0,
],
"6": Array [
2,
],
"7": Array [
1,
],
"8": Array [
1,
],
},
"fnMap": Object {
"0": Object {
"name": "a",
"decl": Object {
"start": Object {
"line": 4,
"column": 30,
},
"end": Object {
"line": 10,
"column": 10,
},
},
"loc": Object {
"start": Object {
"line": 4,
"column": 30,
},
"end": Object {
"line": 10,
"column": 10,
},
},
"line": 4,
},
"1": Object {
"name": "b",
"decl": Object {
"start": Object {
"line": 11,
"column": 8,
},
"end": Object {
"line": 19,
"column": 13,
},
},
"loc": Object {
"start": Object {
"line": 11,
"column": 8,
},
"end": Object {
"line": 19,
"column": 13,
},
},
"line": 11,
},
"2": Object {
"name": "c",
"decl": Object {
"start": Object {
"line": 27,
"column": 1,
},
"end": Object {
"line": 28,
"column": 1,
},
},
"loc": Object {
"start": Object {
"line": 27,
"column": 1,
},
"end": Object {
"line": 28,
"column": 1,
},
},
"line": 27,
},
"3": Object {
"name": "Foo",
"decl": Object {
"start": Object {
"line": 33,
"column": 21,
},
"end": Object {
"line": 37,
"column": 15,
},
},
"loc": Object {
"start": Object {
"line": 33,
"column": 21,
},
"end": Object {
"line": 37,
"column": 15,
},
},
"line": 33,
},
"4": Object {
"name": "hello",
"decl": Object {
"start": Object {
"line": 37,
"column": 24,
},
"end": Object {
"line": 39,
"column": 1,
},
},
"loc": Object {
"start": Object {
"line": 37,
"column": 24,
},
"end": Object {
"line": 39,
"column": 1,
},
},
"line": 37,
},
"5": Object {
"name": "Bar",
"decl": Object {
"start": Object {
"line": 43,
"column": 15,
},
"end": Object {
"line": 44,
"column": 5,
},
},
"loc": Object {
"start": Object {
"line": 43,
"column": 15,
},
"end": Object {
"line": 44,
"column": 5,
},
},
"line": 43,
},
"6": Object {
"name": "hello",
"decl": Object {
"start": Object {
"line": 47,
"column": 5,
},
"end": Object {
"line": 48,
"column": 9,
},
},
"loc": Object {
"start": Object {
"line": 47,
"column": 5,
},
"end": Object {
"line": 48,
"column": 9,
},
},
"line": 47,
},
},
"f": Object {
"0": 0,
"1": 1,
"2": 2,
"3": 0,
"4": 0,
"5": 1,
"6": 1,
},
}
`
exports[`test/v8-to-istanbul.js TAP > undefined 3`] = `
{ path: './test/fixtures/scripts/mixed-newlines.js',
statementMap:
{ '0':
{ start: { line: 1, column: 0 }, end: { line: 1, column: 3 } },
'1':
{ start: { line: 2, column: 0 }, end: { line: 2, column: 5 } },
'2':
{ start: { line: 3, column: 0 }, end: { line: 3, column: 1 } } },
s: { '0': 1, '1': 1, '2': 1 },
branchMap:
{ '0':
{ type: 'branch',
line: 1,
loc:
{ start: { line: 1, column: 0 }, end: { line: 3, column: 1 } },
locations:
[ { start: { line: 1, column: 0 }, end: { line: 3, column: 1 } } ] },
'1':
{ type: 'branch',
line: 1,
loc:
{ start: { line: 1, column: 1 }, end: { line: 3, column: 1 } },
locations:
[ { start: { line: 1, column: 1 }, end: { line: 3, column: 1 } } ] } },
b: { '0': [ 1 ], '1': [ 1 ] },
fnMap: {},
f: {} }
exports[`test/v8-to-istanbul.js TAP > must match snapshot 3`] = `
Object {
"path": "./test/fixtures/scripts/mixed-newlines.js",
"statementMap": Object {
"0": Object {
"start": Object {
"line": 1,
"column": 0,
},
"end": Object {
"line": 1,
"column": 3,
},
},
"1": Object {
"start": Object {
"line": 2,
"column": 0,
},
"end": Object {
"line": 2,
"column": 5,
},
},
"2": Object {
"start": Object {
"line": 3,
"column": 0,
},
"end": Object {
"line": 3,
"column": 1,
},
},
},
"s": Object {
"0": 1,
"1": 1,
"2": 1,
},
"branchMap": Object {
"0": Object {
"type": "branch",
"line": 1,
"loc": Object {
"start": Object {
"line": 1,
"column": 0,
},
"end": Object {
"line": 3,
"column": 1,
},
},
"locations": Array [
Object {
"start": Object {
"line": 1,
"column": 0,
},
"end": Object {
"line": 3,
"column": 1,
},
},
],
},
"1": Object {
"type": "branch",
"line": 1,
"loc": Object {
"start": Object {
"line": 1,
"column": 1,
},
"end": Object {
"line": 3,
"column": 1,
},
},
"locations": Array [
Object {
"start": Object {
"line": 1,
"column": 1,
},
"end": Object {
"line": 3,
"column": 1,
},
},
],
},
},
"b": Object {
"0": Array [
1,
],
"1": Array [
1,
],
},
"fnMap": Object {},
"f": Object {},
}
`
exports[`test/v8-to-istanbul.js TAP > undefined 4`] = `
{ 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: 1,
loc:
{ start: { line: 1, column: 19 }, end: { line: 8, column: 7 } },
locations:
[ { start: { line: 1, column: 19 }, end: { line: 8, column: 7 } } ] },
'1':
{ type: 'branch',
line: 2,
loc:
{ start: { line: 2, column: 0 }, end: { line: 8, column: 7 } },
locations:
[ { start: { line: 2, column: 0 }, end: { line: 8, column: 7 } } ] } },
b: { '0': [ 1 ], '1': [ 1 ] },
fnMap: {},
f: {} }
exports[`test/v8-to-istanbul.js TAP > must match snapshot 4`] = `
Object {
"path": "./test/fixtures/scripts/shebang.js",
"statementMap": Object {
"0": Object {
"start": Object {
"line": 1,
"column": 0,
},
"end": Object {
"line": 1,
"column": 19,
},
},
"1": Object {
"start": Object {
"line": 2,
"column": 0,
},
"end": Object {
"line": 2,
"column": 12,
},
},
"2": Object {
"start": Object {
"line": 3,
"column": 0,
},
"end": Object {
"line": 3,
"column": 0,
},
},
"3": Object {
"start": Object {
"line": 4,
"column": 0,
},
"end": Object {
"line": 4,
"column": 19,
},
},
"4": Object {
"start": Object {
"line": 5,
"column": 0,
},
"end": Object {
"line": 5,
"column": 25,
},
},
"5": Object {
"start": Object {
"line": 6,
"column": 0,
},
"end": Object {
"line": 6,
"column": 1,
},
},
"6": Object {
"start": Object {
"line": 7,
"column": 0,
},
"end": Object {
"line": 7,
"column": 0,
},
},
"7": Object {
"start": Object {
"line": 8,
"column": 0,
},
"end": Object {
"line": 8,
"column": 7,
},
},
},
"s": Object {
"0": 1,
"1": 1,
"2": 1,
"3": 1,
"4": 1,
"5": 1,
"6": 1,
"7": 1,
},
"branchMap": Object {
"0": Object {
"type": "branch",
"line": 1,
"loc": Object {
"start": Object {
"line": 1,
"column": 19,
},
"end": Object {
"line": 8,
"column": 7,
},
},
"locations": Array [
Object {
"start": Object {
"line": 1,
"column": 19,
},
"end": Object {
"line": 8,
"column": 7,
},
},
],
},
"1": Object {
"type": "branch",
"line": 2,
"loc": Object {
"start": Object {
"line": 2,
"column": 0,
},
"end": Object {
"line": 8,
"column": 7,
},
},
"locations": Array [
Object {
"start": Object {
"line": 2,
"column": 0,
},
"end": Object {
"line": 8,
"column": 7,
},
},
],
},
},
"b": Object {
"0": Array [
1,
],
"1": Array [
1,
],
},
"fnMap": Object {},
"f": Object {},
}
`
exports[`test/v8-to-istanbul.js TAP > undefined 5`] = `
{ path: 'test/fixtures/scripts/branches.js',
statementMap:
{ '0':
{ start: { line: 1, column: 0 }, end: { line: 1, column: 26 } },
'1':
{ start: { line: 2, column: 0 }, end: { line: 2, column: 18 } },
'2':
{ start: { line: 3, column: 0 }, end: { line: 3, column: 0 } },
'3':
{ start: { line: 4, column: 0 }, end: { line: 4, column: 31 } },
'4':
{ start: { line: 5, column: 0 }, end: { line: 5, column: 37 } },
'5':
{ start: { line: 6, column: 0 }, end: { line: 6, column: 0 } },
'6':
{ start: { line: 7, column: 0 }, end: { line: 7, column: 18 } },
'7':
{ start: { line: 8, column: 0 }, end: { line: 8, column: 31 } },
'8':
{ start: { line: 9, column: 0 }, end: { line: 9, column: 0 } },
'9':
{ start: { line: 10, column: 0 },
end: { line: 10, column: 16 } },
'10':
{ start: { line: 11, column: 0 },
end: { line: 11, column: 12 } },
'11':
{ start: { line: 12, column: 0 },
end: { line: 12, column: 14 } },
'12':
{ start: { line: 13, column: 0 }, end: { line: 13, column: 1 } },
'13':
{ start: { line: 14, column: 0 }, end: { line: 14, column: 8 } },
'14':
{ start: { line: 15, column: 0 },
end: { line: 15, column: 25 } },
'15':
{ start: { line: 16, column: 0 }, end: { line: 16, column: 3 } },
'16':
{ start: { line: 17, column: 0 }, end: { line: 17, column: 0 } },
'17':
{ start: { line: 18, column: 0 },
end: { line: 18, column: 28 } },
'18':
{ start: { line: 19, column: 0 },
end: { line: 19, column: 15 } },
'19':
{ start: { line: 20, column: 0 },
end: { line: 20, column: 13 } },
'20':
{ start: { line: 21, column: 0 },
end: { line: 21, column: 23 } },
'21':
{ start: { line: 22, column: 0 },
end: { line: 22, column: 10 } },
'22':
{ start: { line: 23, column: 0 },
end: { line: 23, column: 16 } },
'23':
{ start: { line: 24, column: 0 }, end: { line: 24, column: 3 } },
'24':
{ start: { line: 25, column: 0 }, end: { line: 25, column: 1 } },
'25':
{ start: { line: 26, column: 0 }, end: { line: 26, column: 0 } },
'26':
{ start: { line: 27, column: 0 }, end: { line: 27, column: 3 } },
'27':
{ start: { line: 28, column: 0 }, end: { line: 28, column: 0 } },
'28':
{ start: { line: 29, column: 0 },
end: { line: 29, column: 46 } },
'29':
{ start: { line: 30, column: 0 },
end: { line: 30, column: 15 } },
'30':
{ start: { line: 31, column: 0 },
end: { line: 31, column: 10 } } },
s:
{ '0': 0,
'1': 1,
'2': 1,
'3': 1,
'4': 1,
'5': 1,
'6': 1,
'7': 1,
'8': 1,
'9': 1,
'10': 1,
'11': 1,
'12': 1,
'13': 1,
'14': 0,
'15': 0,
'16': 0,
'17': 0,
'18': 1,
'19': 1,
'20': 1,
'21': 1,
'22': 1,
'23': 1,
'24': 1,
'25': 1,
'26': 1,
'27': 1,
'28': 0,
'29': 1,
'30': 1 },
branchMap:
{ '0':
{ type: 'branch',
line: 31,
loc:
{ start: { line: 31, column: 10 },
end: { line: 31, column: 10 } },
locations:
[ { start: { line: 31, column: 10 },
end: { line: 31, column: 10 } } ] },
'1':
{ type: 'branch',
line: 5,
loc:
{ start: { line: 5, column: 7 }, end: { line: 5, column: 18 } },
locations:
[ { start: { line: 5, column: 7 }, end: { line: 5, column: 18 } } ] },
'2':
{ type: 'branch',
line: 8,
loc:
{ start: { line: 8, column: 0 }, end: { line: 8, column: 11 } },
locations:
[ { start: { line: 8, column: 0 }, end: { line: 8, column: 11 } } ] },
'3':
{ type: 'branch',
line: 11,
loc:
{ start: { line: 11, column: 11 },
end: { line: 12, column: 12 } },
locations:
[ { start: { line: 11, column: 11 },
end: { line: 12, column: 12 } } ] },
'4':
{ type: 'branch',
line: 14,
loc:
{ start: { line: 14, column: 7 },
end: { line: 18, column: 28 } },
locations:
[ { start: { line: 14, column: 7 },
end: { line: 18, column: 28 } } ] },
'5':
{ type: 'branch',
line: 31,
loc:
{ start: { line: 31, column: 10 },
end: { line: 31, column: 10 } },
locations:
[ { start: { line: 31, column: 10 },
end: { line: 31, column: 10 } } ] },
'6':
{ type: 'branch',
line: 1,
loc:
{ start: { line: 1, column: 0 }, end: { line: 2, column: 16 } },
locations:
[ { start: { line: 1, column: 0 }, end: { line: 2, column: 16 } } ] },
'7':
{ type: 'branch',
line: 1,
loc:
{ start: { line: 1, column: 0 }, end: { line: 2, column: 6 } },
locations:
[ { start: { line: 1, column: 0 }, end: { line: 2, column: 6 } } ] },
'8':
{ type: 'branch',
line: 2,
loc:
{ start: { line: 2, column: 0 }, end: { line: 2, column: 10 } },
locations:
[ { start: { line: 2, column: 0 }, end: { line: 2, column: 10 } } ] },
'9':
{ type: 'branch',
line: 20,
loc:
{ start: { line: 20, column: 12 },
end: { line: 30, column: 10 } },
locations:
[ { start: { line: 20, column: 12 },
end: { line: 30, column: 10 } } ] },
'10':
{ type: 'branch',
line: 29,
loc:
{ start: { line: 29, column: 0 },
end: { line: 30, column: 10 } },
locations:
[ { start: { line: 29, column: 0 },
end: { line: 30, column: 10 } } ] } },
b:
{ '0': [ 1 ],
'1': [ 0 ],
'2': [ 0 ],
'3': [ 0 ],
'4': [ 0 ],
'5': [ 0 ],
'6': [ 1 ],
'7': [ 0 ],
'8': [ 0 ],
'9': [ 1 ],
'10': [ 0 ] },
fnMap:
{ '0':
{ name: 'e',
decl:
{ start: { line: 20, column: 12 },
end: { line: 30, column: 10 } },
loc:
{ start: { line: 20, column: 12 },
end: { line: 30, column: 10 } },
line: 20 } },
f: { '0': 1 } }
exports[`test/v8-to-istanbul.js TAP > must match snapshot 5`] = `
Object {
"path": "test/fixtures/scripts/branches.js",
"statementMap": Object {
"0": Object {
"start": Object {
"line": 1,
"column": 0,
},
"end": Object {
"line": 1,
"column": 26,
},
},
"1": Object {
"start": Object {
"line": 2,
"column": 0,
},
"end": Object {
"line": 2,
"column": 18,
},
},
"2": Object {
"start": Object {
"line": 3,
"column": 0,
},
"end": Object {
"line": 3,
"column": 0,
},
},
"3": Object {
"start": Object {
"line": 4,
"column": 0,
},
"end": Object {
"line": 4,
"column": 31,
},
},
"4": Object {
"start": Object {
"line": 5,
"column": 0,
},
"end": Object {
"line": 5,
"column": 37,
},
},
"5": Object {
"start": Object {
"line": 6,
"column": 0,
},
"end": Object {
"line": 6,
"column": 0,
},
},
"6": Object {
"start": Object {
"line": 7,
"column": 0,
},
"end": Object {
"line": 7,
"column": 18,
},
},
"7": Object {
"start": Object {
"line": 8,
"column": 0,
},
"end": Object {
"line": 8,
"column": 31,
},
},
"8": Object {
"start": Object {
"line": 9,
"column": 0,
},
"end": Object {
"line": 9,
"column": 0,
},
},
"9": Object {
"start": Object {
"line": 10,
"column": 0,
},
"end": Object {
"line": 10,
"column": 16,
},
},
"10": Object {
"start": Object {
"line": 11,
"column": 0,
},
"end": Object {
"line": 11,
"column": 12,
},
},
"11": Object {
"start": Object {
"line": 12,
"column": 0,
},
"end": Object {
"line": 12,
"column": 14,
},
},
"12": Object {
"start": Object {
"line": 13,
"column": 0,
},
"end": Object {
"line": 13,
"column": 1,
},
},
"13": Object {
"start": Object {
"line": 14,
"column": 0,
},
"end": Object {
"line": 14,
"column": 8,
},
},
"14": Object {
"start": Object {
"line": 15,
"column": 0,
},
"end": Object {
"line": 15,
"column": 25,
},
},
"15": Object {
"start": Object {
"line": 16,
"column": 0,
},
"end": Object {
"line": 16,
"column": 3,
},
},
"16": Object {
"start": Object {
"line": 17,
"column": 0,
},
"end": Object {
"line": 17,
"column": 0,
},
},
"17": Object {
"start": Object {
"line": 18,
"column": 0,
},
"end": Object {
"line": 18,
"column": 28,
},
},
"18": Object {
"start": Object {
"line": 19,
"column": 0,
},
"end": Object {
"line": 19,
"column": 15,
},
},
"19": Object {
"start": Object {
"line": 20,
"column": 0,
},
"end": Object {
"line": 20,
"column": 13,
},
},
"20": Object {
"start": Object {
"line": 21,
"column": 0,
},
"end": Object {
"line": 21,
"column": 23,
},
},
"21": Object {
"start": Object {
"line": 22,
"column": 0,
},
"end": Object {
"line": 22,
"column": 10,
},
},
"22": Object {
"start": Object {
"line": 23,
"column": 0,
},
"end": Object {
"line": 23,
"column": 16,
},
},
"23": Object {
"start": Object {
"line": 24,
"column": 0,
},
"end": Object {
"line": 24,
"column": 3,
},
},
"24": Object {
"start": Object {
"line": 25,
"column": 0,
},
"end": Object {
"line": 25,
"column": 1,
},
},
"25": Object {
"start": Object {
"line": 26,
"column": 0,
},
"end": Object {
"line": 26,
"column": 0,
},
},
"26": Object {
"start": Object {
"line": 27,
"column": 0,
},
"end": Object {
"line": 27,
"column": 3,
},
},
"27": Object {
"start": Object {
"line": 28,
"column": 0,
},
"end": Object {
"line": 28,
"column": 0,
},
},
"28": Object {
"start": Object {
"line": 29,
"column": 0,
},
"end": Object {
"line": 29,
"column": 46,
},
},
"29": Object {
"start": Object {
"line": 30,
"column": 0,
},
"end": Object {
"line": 30,
"column": 15,
},
},
"30": Object {
"start": Object {
"line": 31,
"column": 0,
},
"end": Object {
"line": 31,
"column": 10,
},
},
},
"s": Object {
"0": 0,
"1": 1,
"2": 1,
"3": 1,
"4": 1,
"5": 1,
"6": 1,
"7": 1,
"8": 1,
"9": 1,
"10": 1,
"11": 1,
"12": 1,
"13": 1,
"14": 0,
"15": 0,
"16": 0,
"17": 0,
"18": 1,
"19": 1,
"20": 1,
"21": 1,
"22": 1,
"23": 1,
"24": 1,
"25": 1,
"26": 1,
"27": 1,
"28": 0,
"29": 1,
"30": 1,
},
"branchMap": Object {
"0": Object {
"type": "branch",
"line": 31,
"loc": Object {
"start": Object {
"line": 31,
"column": 10,
},
"end": Object {
"line": 31,
"column": 10,
},
},
"locations": Array [
Object {
"start": Object {
"line": 31,
"column": 10,
},
"end": Object {
"line": 31,
"column": 10,
},
},
],
},
"1": Object {
"type": "branch",
"line": 5,
"loc": Object {
"start": Object {
"line": 5,
"column": 7,
},
"end": Object {
"line": 5,
"column": 18,
},
},
"locations": Array [
Object {
"start": Object {
"line": 5,
"column": 7,
},
"end": Object {
"line": 5,
"column": 18,
},
},
],
},
"2": Object {
"type": "branch",
"line": 8,
"loc": Object {
"start": Object {
"line": 8,
"column": 0,
},
"end": Object {
"line": 8,
"column": 11,
},
},
"locations": Array [
Object {
"start": Object {
"line": 8,
"column": 0,
},
"end": Object {
"line": 8,
"column": 11,
},
},
],
},
"3": Object {
"type": "branch",
"line": 11,
"loc": Object {
"start": Object {
"line": 11,
"column": 11,
},
"end": Object {
"line": 12,
"column": 12,
},
},
"locations": Array [
Object {
"start": Object {
"line": 11,
"column": 11,
},
"end": Object {
"line": 12,
"column": 12,
},
},
],
},
"4": Object {
"type": "branch",
"line": 14,
"loc": Object {
"start": Object {
"line": 14,
"column": 7,
},
"end": Object {
"line": 18,
"column": 28,
},
},
"locations": Array [
Object {
"start": Object {
"line": 14,
"column": 7,
},
"end": Object {
"line": 18,
"column": 28,
},
},
],
},
"5": Object {
"type": "branch",
"line": 31,
"loc": Object {
"start": Object {
"line": 31,
"column": 10,
},
"end": Object {
"line": 31,
"column": 10,
},
},
"locations": Array [
Object {
"start": Object {
"line": 31,
"column": 10,
},
"end": Object {
"line": 31,
"column": 10,
},
},
],
},
"6": Object {
"type": "branch",
"line": 1,
"loc": Object {
"start": Object {
"line": 1,
"column": 0,
},
"end": Object {
"line": 2,
"column": 16,
},
},
"locations": Array [
Object {
"start": Object {
"line": 1,
"column": 0,
},
"end": Object {
"line": 2,
"column": 16,
},
},
],
},
"7": Object {
"type": "branch",
"line": 1,
"loc": Object {
"start": Object {
"line": 1,
"column": 0,
},
"end": Object {
"line": 2,
"column": 6,
},
},
"locations": Array [
Object {
"start": Object {
"line": 1,
"column": 0,
},
"end": Object {
"line": 2,
"column": 6,
},
},
],
},
"8": Object {
"type": "branch",
"line": 2,
"loc": Object {
"start": Object {
"line": 2,
"column": 0,
},
"end": Object {
"line": 2,
"column": 10,
},
},
"locations": Array [
Object {
"start": Object {
"line": 2,
"column": 0,
},
"end": Object {
"line": 2,
"column": 10,
},
},
],
},
"9": Object {
"type": "branch",
"line": 20,
"loc": Object {
"start": Object {
"line": 20,
"column": 12,
},
"end": Object {
"line": 30,
"column": 10,
},
},
"locations": Array [
Object {
"start": Object {
"line": 20,
"column": 12,
},
"end": Object {
"line": 30,
"column": 10,
},
},
],
},
"10": Object {
"type": "branch",
"line": 29,
"loc": Object {
"start": Object {
"line": 29,
"column": 0,
},
"end": Object {
"line": 30,
"column": 10,
},
},
"locations": Array [
Object {
"start": Object {
"line": 29,
"column": 0,
},
"end": Object {
"line": 30,
"column": 10,
},
},
],
},
},
"b": Object {
"0": Array [
1,
],
"1": Array [
0,
],
"2": Array [
0,
],
"3": Array [
0,
],
"4": Array [
0,
],
"5": Array [
0,
],
"6": Array [
1,
],
"7": Array [
0,
],
"8": Array [
0,
],
"9": Array [
1,
],
"10": Array [
0,
],
},
"fnMap": Object {
"0": Object {
"name": "e",
"decl": Object {
"start": Object {
"line": 20,
"column": 12,
},
"end": Object {
"line": 30,
"column": 10,
},
},
"loc": Object {
"start": Object {
"line": 20,
"column": 12,
},
"end": Object {
"line": 30,
"column": 10,
},
},
"line": 20,
},
},
"f": Object {
"0": 1,
},
}
`

@@ -36,2 +36,36 @@ /* global describe, it */

})
describe('ignore', () => {
it('ignores the next line if /* c8 ignore next */ is on its own line', () => {
const sourceRaw = `
const a = 33
/* c8 ignore next */
const a = 99
`
const source = new CovSource(sourceRaw, 0)
source.lines[2].ignore.should.equal(false)
source.lines[3].ignore.should.equal(true)
})
it('ignores the next N lines if /* c8 ignore next N */ is used', () => {
const sourceRaw = `
/* c8 ignore next 2 */
const a = 33
const a = 99
`
const source = new CovSource(sourceRaw, 0)
source.lines[2].ignore.should.equal(true)
source.lines[3].ignore.should.equal(true)
})
it('ignores a line that contains /* c8 ignore next */', () => {
const sourceRaw = `
const a = foo ? true /* c8 ignore next */ : false
const b = 99
`
const source = new CovSource(sourceRaw, 0)
source.lines[1].ignore.should.equal(true)
source.lines[2].ignore.should.equal(false)
})
})
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc