Skip to content

Commit

Permalink
chore: updating all dependencies (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoe committed Oct 6, 2019
1 parent 368b4bd commit 2a806ee
Show file tree
Hide file tree
Showing 8 changed files with 1,025 additions and 1,007 deletions.
1 change: 1 addition & 0 deletions lib/branch.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module.exports = class CovBranch {
this.endCol = endCol
this.count = count
}

toIstanbul () {
const location = {
start: {
Expand Down
1 change: 1 addition & 0 deletions lib/function.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module.exports = class CovFunction {
this.endCol = endCol
this.count = count
}

toIstanbul () {
const loc = {
start: {
Expand Down
1 change: 1 addition & 0 deletions lib/line.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ module.exports = class CovLine {
// set by source.js during parsing, if /* c8 ignore next */ is found.
this.ignore = false
}

toIstanbul () {
return {
start: {
Expand Down
8 changes: 6 additions & 2 deletions lib/source.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ module.exports = class CovSource {
this.wrapperLength = wrapperLength - this.shebangLength
this._buildLines(sourceRaw)
}

_buildLines (source) {
let position = 0
let ignoreCount = 0
Expand All @@ -25,12 +26,13 @@ module.exports = class CovSource {
position += lineStr.length
}
}

_parseIgnoreNext (lineStr, line) {
const testIgnoreNextLines = lineStr.match(/^\W*\/\* c8 ignore next (?<count>[0-9]+)? *\*\/\W*$/)
if (testIgnoreNextLines) {
line.ignore = true
if (testIgnoreNextLines.groups['count']) {
return Number(testIgnoreNextLines.groups['count'])
if (testIgnoreNextLines.groups.count) {
return Number(testIgnoreNextLines.groups.count)
} else {
return 1
}
Expand All @@ -42,6 +44,7 @@ module.exports = class CovSource {

return 0
}

// given a start column and end column in absolute offsets within
// a source file (0 - EOF), returns the relative line column positions.
offsetToOriginalRelative (sourceMap, startCol, endCol) {
Expand Down Expand Up @@ -89,6 +92,7 @@ module.exports = class CovSource {
relEndCol: end.column
}
}

relativeToOffset (line, relCol) {
line = Math.max(line, 1)
if (this.lines[line - 1] === undefined) return this.eof
Expand Down
7 changes: 7 additions & 0 deletions lib/v8-to-istanbul.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ module.exports = class V8ToIstanbul {
this.source = undefined
this.sourceTranspiled = undefined
}

async load () {
const rawSource = this.sources.source || await readFile(this.path, 'utf8')
const rawSourceMap = this.sources.sourceMap ||
Expand Down Expand Up @@ -63,6 +64,7 @@ module.exports = class V8ToIstanbul {
this.source = new CovSource(rawSource, this.wrapperLength)
}
}

applyCoverage (blocks) {
blocks.forEach(block => {
block.ranges.forEach((range, i) => {
Expand Down Expand Up @@ -129,6 +131,7 @@ module.exports = class V8ToIstanbul {
})
})
}

_maybeRemapStartColEndCol (range) {
let startCol = Math.max(0, range.startOffset - this.source.wrapperLength)
let endCol = Math.min(this.source.eof, range.endOffset - this.source.wrapperLength)
Expand All @@ -154,6 +157,7 @@ module.exports = class V8ToIstanbul {
endCol
}
}

toIstanbul () {
const istanbulInner = Object.assign(
{ path: this.path },
Expand All @@ -165,6 +169,7 @@ module.exports = class V8ToIstanbul {
istanbulOuter[this.path] = istanbulInner
return istanbulOuter
}

_statementsToIstanbul () {
const statements = {
statementMap: {},
Expand All @@ -176,6 +181,7 @@ module.exports = class V8ToIstanbul {
})
return statements
}

_branchesToIstanbul () {
const branches = {
branchMap: {},
Expand All @@ -188,6 +194,7 @@ module.exports = class V8ToIstanbul {
})
return branches
}

_functionsToIstanbul () {
const functions = {
fnMap: {},
Expand Down
Loading

0 comments on commit 2a806ee

Please sign in to comment.