Socket
Socket
Sign inDemoInstall

v8-to-istanbul

Package Overview
Dependencies
0
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.3 to 2.0.4

9

CHANGELOG.md

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

## [2.0.4](https://github.com/bcoe/v8-to-istanbul/compare/v2.0.3...v2.0.4) (2019-04-07)
### Bug Fixes
* Node 11 no longer wraps scripts by default ([#15](https://github.com/bcoe/v8-to-istanbul/issues/15)) ([fbbd113](https://github.com/bcoe/v8-to-istanbul/commit/fbbd113))
## [2.0.3](https://github.com/bcoe/v8-to-istanbul/compare/v2.0.2...v2.0.3) (2019-04-07)

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

24

lib/script.js

@@ -7,8 +7,9 @@ const assert = require('assert')

// Injected when Node.js is loading script into isolate.
const isWindows = process.platform === 'win32'
const isNode10 = !!process.version.match(/^v10/)
// Injected when Node.js is loading script into isolate pre Node 11.
// see: https://github.com/nodejs/node/pull/21573.
const cjsWrapperLength = require('module').wrapper[0].length
const cjsWrapperLength = isNode10 ? require('module').wrapper[0].length : 0
const isWindows = process.platform === 'win32'
module.exports = class CovScript {

@@ -21,3 +22,4 @@ constructor (scriptPath, wrapperLength) {

this.wrapperLength = wrapperLength === undefined ? cjsWrapperLength : wrapperLength
this.wrapperLength -= shebangLength(source)
const shebangLength = getShebangLength(source)
this.wrapperLength -= shebangLength
this.lines = []

@@ -27,10 +29,12 @@ this.branches = []

this.eof = -1
this._buildLines(source, this.lines)
this._buildLines(source, this.lines, shebangLength)
}
_buildLines (source, lines) {
_buildLines (source, lines, shebangLength) {
let position = 0
const separator = isWindows ? '\r\n' : '\n'
source.split(separator).forEach((lineStr, i) => {
;(source.trim()).split(separator).forEach((lineStr, i) => {
this.eof = position + lineStr.length
lines.push(new CovLine(i + 1, position, this.eof))
const line = new CovLine(i + 1, position, this.eof)
if (i === 0 && shebangLength !== 0) line.count = 1
lines.push(line)
position += lineStr.length + separator.length

@@ -141,3 +145,3 @@ })

function shebangLength (source) {
function getShebangLength (source) {
if (source.indexOf('#!') === 0) {

@@ -144,0 +148,0 @@ const match = source.match(/(?<shebang>#!.*)/)

{
"name": "v8-to-istanbul",
"version": "2.0.3",
"version": "2.0.4",
"description": "convert from v8 coverage format to istanbul's format",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -85,5 +85,3 @@ /* IMPORTANT

{ start: { line: 31, column: 0 },
end: { line: 31, column: 10 } },
'31':
{ start: { line: 32, column: 0 }, end: { line: 32, column: 0 } } },
end: { line: 31, column: 10 } } },
s:

@@ -101,4 +99,4 @@ { '0': 1,

'10': 1,
'11': 0,
'12': 0,
'11': 1,
'12': 1,
'13': 1,

@@ -113,4 +111,4 @@ '14': 1,

'21': 1,
'22': 0,
'23': 0,
'22': 1,
'23': 1,
'24': 1,

@@ -122,4 +120,3 @@ '25': 1,

'29': 1,
'30': 1,
'31': 1 },
'30': 1 },
branchMap:

@@ -130,5 +127,5 @@ { '0':

loc:
{ start: { line: 1, column: 0 }, end: { line: 32, column: 0 } },
{ start: { line: 1, column: 0 }, end: { line: 31, column: 10 } },
locations:
[ { start: { line: 1, column: 0 }, end: { line: 32, column: 0 } } ] },
[ { start: { line: 1, column: 0 }, end: { line: 31, column: 10 } } ] },
'1':

@@ -138,5 +135,5 @@ { type: 'branch',

loc:
{ start: { line: 1, column: 0 }, end: { line: 32, column: 0 } },
{ start: { line: 1, column: 1 }, end: { line: 31, column: 10 } },
locations:
[ { start: { line: 1, column: 0 }, end: { line: 32, column: 0 } } ] },
[ { start: { line: 1, column: 1 }, end: { line: 31, column: 10 } } ] },
'2':

@@ -146,5 +143,5 @@ { type: 'branch',

loc:
{ start: { line: 2, column: 13 }, end: { line: 2, column: 18 } },
{ start: { line: 5, column: 23 }, end: { line: 5, column: 28 } },
locations:
[ { start: { line: 2, column: 13 }, end: { line: 2, column: 18 } } ] },
[ { start: { line: 5, column: 23 }, end: { line: 5, column: 28 } } ] },
'3':

@@ -154,5 +151,5 @@ { type: 'branch',

loc:
{ start: { line: 5, column: 18 }, end: { line: 5, column: 25 } },
{ start: { line: 8, column: 22 }, end: { line: 8, column: 29 } },
locations:
[ { start: { line: 5, column: 18 }, end: { line: 5, column: 25 } } ] },
[ { start: { line: 8, column: 22 }, end: { line: 8, column: 29 } } ] },
'4':

@@ -162,5 +159,5 @@ { type: 'branch',

loc:
{ start: { line: 8, column: 26 }, end: { line: 8, column: 31 } },
{ start: { line: 14, column: 8 }, end: { line: 15, column: 4 } },
locations:
[ { start: { line: 8, column: 26 }, end: { line: 8, column: 31 } } ] },
[ { start: { line: 14, column: 8 }, end: { line: 15, column: 4 } } ] },
'5':

@@ -170,7 +167,7 @@ { type: 'branch',

loc:
{ start: { line: 11, column: 11 },
end: { line: 13, column: 1 } },
{ start: { line: 18, column: 3 },
end: { line: 18, column: 21 } },
locations:
[ { start: { line: 11, column: 11 },
end: { line: 13, column: 1 } } ] },
[ { start: { line: 18, column: 3 },
end: { line: 18, column: 21 } } ] },
'6':

@@ -180,7 +177,5 @@ { type: 'branch',

loc:
{ start: { line: 31, column: 5 },
end: { line: 31, column: 10 } },
{ start: { line: 22, column: 8 }, end: { line: 30, column: 8 } },
locations:
[ { start: { line: 31, column: 5 },
end: { line: 31, column: 10 } } ] },
[ { start: { line: 22, column: 8 }, end: { line: 30, column: 8 } } ] },
'7':

@@ -190,12 +185,7 @@ { type: 'branch',

loc:
{ start: { line: 19, column: 0 }, end: { line: 25, column: 1 } },
{ start: { line: 29, column: 31 },
end: { line: 30, column: 6 } },
locations:
[ { start: { line: 19, column: 0 }, end: { line: 25, column: 1 } } ] },
'8':
{ type: 'branch',
line: undefined,
loc:
{ start: { line: 22, column: 9 }, end: { line: 24, column: 3 } },
locations:
[ { start: { line: 22, column: 9 }, end: { line: 24, column: 3 } } ] } },
[ { start: { line: 29, column: 31 },
end: { line: 30, column: 6 } } ] } },
b:

@@ -208,5 +198,4 @@ { '0': [ 1 ],

'5': [ 0 ],
'6': [ 0 ],
'7': [ 1 ],
'8': [ 0 ] },
'6': [ 1 ],
'7': [ 0 ] },
fnMap:

@@ -216,6 +205,6 @@ { '0':

decl:
{ start: { line: 19, column: 0 }, end: { line: 25, column: 1 } },
{ start: { line: 22, column: 8 }, end: { line: 30, column: 8 } },
loc:
{ start: { line: 19, column: 0 }, end: { line: 25, column: 1 } },
line: 19 } },
{ start: { line: 22, column: 8 }, end: { line: 30, column: 8 } },
line: 22 } },
f: { '0': 1 } }

@@ -343,15 +332,13 @@ `

'47':
{ start: { line: 48, column: 0 }, end: { line: 48, column: 9 } },
'48':
{ start: { line: 49, column: 0 }, end: { line: 49, column: 0 } } },
{ start: { line: 48, column: 0 }, end: { line: 48, column: 9 } } },
s:
{ '0': 1,
'1': 0,
'2': 0,
'3': 0,
'1': 1,
'2': 1,
'3': 1,
'4': 0,
'5': 0,
'6': 1,
'7': 1,
'8': 1,
'6': 0,
'7': 0,
'8': 0,
'9': 1,

@@ -367,6 +354,6 @@ '10': 1,

'18': 1,
'19': 2,
'20': 2,
'21': 2,
'22': 2,
'19': 1,
'20': 1,
'21': 1,
'22': 1,
'23': 1,

@@ -378,11 +365,11 @@ '24': 1,

'28': 1,
'29': 0,
'30': 0,
'29': 1,
'30': 1,
'31': 1,
'32': 0,
'32': 1,
'33': 0,
'34': 1,
'35': 1,
'34': 0,
'35': 0,
'36': 1,
'37': 1,
'37': 0,
'38': 1,

@@ -397,4 +384,3 @@ '39': 1,

'46': 1,
'47': 1,
'48': 1 },
'47': 1 },
branchMap:

@@ -405,5 +391,5 @@ { '0':

loc:
{ start: { line: 1, column: 0 }, end: { line: 49, column: 0 } },
{ start: { line: 1, column: 0 }, end: { line: 48, column: 9 } },
locations:
[ { start: { line: 1, column: 0 }, end: { line: 49, column: 0 } } ] },
[ { start: { line: 1, column: 0 }, end: { line: 48, column: 9 } } ] },
'1':

@@ -413,5 +399,5 @@ { type: 'branch',

loc:
{ start: { line: 1, column: 0 }, end: { line: 49, column: 0 } },
{ start: { line: 1, column: 1 }, end: { line: 48, column: 9 } },
locations:
[ { start: { line: 1, column: 0 }, end: { line: 49, column: 0 } } ] },
[ { start: { line: 1, column: 1 }, end: { line: 48, column: 9 } } ] },
'2':

@@ -421,5 +407,7 @@ { type: 'branch',

loc:
{ start: { line: 9, column: 2 }, end: { line: 14, column: 3 } },
{ start: { line: 11, column: 8 },
end: { line: 19, column: 13 } },
locations:
[ { start: { line: 9, column: 2 }, end: { line: 14, column: 3 } } ] },
[ { start: { line: 11, column: 8 },
end: { line: 19, column: 13 } } ] },
'3':

@@ -429,7 +417,5 @@ { type: 'branch',

loc:
{ start: { line: 10, column: 28 },
end: { line: 10, column: 37 } },
{ start: { line: 13, column: 6 }, end: { line: 14, column: 1 } },
locations:
[ { start: { line: 10, column: 28 },
end: { line: 10, column: 37 } } ] },
[ { start: { line: 13, column: 6 }, end: { line: 14, column: 1 } } ] },
'4':

@@ -439,7 +425,7 @@ { type: 'branch',

loc:
{ start: { line: 12, column: 18 },
end: { line: 12, column: 23 } },
{ start: { line: 18, column: 32 },
end: { line: 18, column: 37 } },
locations:
[ { start: { line: 12, column: 18 },
end: { line: 12, column: 23 } } ] },
[ { start: { line: 18, column: 32 },
end: { line: 18, column: 37 } } ] },
'5':

@@ -449,7 +435,7 @@ { type: 'branch',

loc:
{ start: { line: 13, column: 13 },
end: { line: 14, column: 2 } },
{ start: { line: 19, column: 9 },
end: { line: 19, column: 12 } },
locations:
[ { start: { line: 13, column: 13 },
end: { line: 14, column: 2 } } ] },
[ { start: { line: 19, column: 9 },
end: { line: 19, column: 12 } } ] },
'6':

@@ -459,7 +445,5 @@ { type: 'branch',

loc:
{ start: { line: 19, column: 10 },
end: { line: 23, column: 1 } },
{ start: { line: 27, column: 1 }, end: { line: 28, column: 1 } },
locations:
[ { start: { line: 19, column: 10 },
end: { line: 23, column: 1 } } ] },
[ { start: { line: 27, column: 1 }, end: { line: 28, column: 1 } } ] },
'7':

@@ -469,7 +453,7 @@ { type: 'branch',

loc:
{ start: { line: 39, column: 16 },
end: { line: 41, column: 5 } },
{ start: { line: 43, column: 15 },
end: { line: 44, column: 5 } },
locations:
[ { start: { line: 39, column: 16 },
end: { line: 41, column: 5 } } ] },
[ { start: { line: 43, column: 15 },
end: { line: 44, column: 5 } } ] },
'8':

@@ -479,7 +463,5 @@ { type: 'branch',

loc:
{ start: { line: 42, column: 10 },
end: { line: 44, column: 5 } },
{ start: { line: 47, column: 5 }, end: { line: 48, column: 9 } },
locations:
[ { start: { line: 42, column: 10 },
end: { line: 44, column: 5 } } ] } },
[ { start: { line: 47, column: 5 }, end: { line: 48, column: 9 } } ] } },
b:

@@ -499,56 +481,58 @@ { '0': [ 1 ],

decl:
{ start: { line: 2, column: 0 }, end: { line: 6, column: 1 } },
{ start: { line: 4, column: 30 },
end: { line: 10, column: 10 } },
loc:
{ start: { line: 2, column: 0 }, end: { line: 6, column: 1 } },
line: 2 },
{ start: { line: 4, column: 30 },
end: { line: 10, column: 10 } },
line: 4 },
'1':
{ name: 'b',
decl:
{ start: { line: 9, column: 2 }, end: { line: 14, column: 3 } },
{ start: { line: 11, column: 8 },
end: { line: 19, column: 13 } },
loc:
{ start: { line: 9, column: 2 }, end: { line: 14, column: 3 } },
line: 9 },
{ start: { line: 11, column: 8 },
end: { line: 19, column: 13 } },
line: 11 },
'2':
{ name: 'c',
decl:
{ start: { line: 19, column: 10 },
end: { line: 23, column: 1 } },
{ start: { line: 27, column: 1 }, end: { line: 28, column: 1 } },
loc:
{ start: { line: 19, column: 10 },
end: { line: 23, column: 1 } },
line: 19 },
{ start: { line: 27, column: 1 }, end: { line: 28, column: 1 } },
line: 27 },
'3':
{ name: 'Foo',
decl:
{ start: { line: 29, column: 14 },
end: { line: 31, column: 3 } },
{ start: { line: 33, column: 21 },
end: { line: 37, column: 15 } },
loc:
{ start: { line: 29, column: 14 },
end: { line: 31, column: 3 } },
line: 29 },
{ start: { line: 33, column: 21 },
end: { line: 37, column: 15 } },
line: 33 },
'4':
{ name: 'hello',
decl:
{ start: { line: 32, column: 8 }, end: { line: 34, column: 3 } },
{ start: { line: 37, column: 24 },
end: { line: 39, column: 1 } },
loc:
{ start: { line: 32, column: 8 }, end: { line: 34, column: 3 } },
line: 32 },
{ start: { line: 37, column: 24 },
end: { line: 39, column: 1 } },
line: 37 },
'5':
{ name: 'Bar',
decl:
{ start: { line: 39, column: 16 },
end: { line: 41, column: 5 } },
{ start: { line: 43, column: 15 },
end: { line: 44, column: 5 } },
loc:
{ start: { line: 39, column: 16 },
end: { line: 41, column: 5 } },
line: 39 },
{ start: { line: 43, column: 15 },
end: { line: 44, column: 5 } },
line: 43 },
'6':
{ name: 'hello',
decl:
{ start: { line: 42, column: 10 },
end: { line: 44, column: 5 } },
{ start: { line: 47, column: 5 }, end: { line: 48, column: 9 } },
loc:
{ start: { line: 42, column: 10 },
end: { line: 44, column: 5 } },
line: 42 } },
{ 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 } }

@@ -583,5 +567,5 @@ `

loc:
{ start: { line: 1, column: 0 }, end: { line: 8, column: 7 } },
{ start: { line: 1, column: 19 }, end: { line: 8, column: 7 } },
locations:
[ { start: { line: 1, column: 0 }, end: { line: 8, column: 7 } } ] },
[ { start: { line: 1, column: 19 }, end: { line: 8, column: 7 } } ] },
'1':

@@ -591,22 +575,8 @@ { type: 'branch',

loc:
{ start: { line: 1, column: 0 }, end: { line: 8, column: 7 } },
{ start: { line: 2, 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 } }
[ { start: { line: 2, column: 0 }, end: { line: 8, column: 7 } } ] } },
b: { '0': [ 1 ], '1': [ 1 ] },
fnMap: {},
f: {} }
`

@@ -17,4 +17,4 @@ /* global describe, it */

)
script.lines.length.should.equal(49)
script.wrapperLength.should.equal(62) // common-js header.
script.lines.length.should.equal(48)
script.wrapperLength.should.equal(0) // common-js header.
})

@@ -27,3 +27,3 @@

)
script.lines.length.should.equal(49)
script.lines.length.should.equal(48)
script.wrapperLength.should.equal(0) // ESM header.

@@ -30,0 +30,0 @@ })

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc