diff --git a/lib/v8-to-istanbul.js b/lib/v8-to-istanbul.js index e5be920c..f4bd25d0 100644 --- a/lib/v8-to-istanbul.js +++ b/lib/v8-to-istanbul.js @@ -257,7 +257,8 @@ module.exports = class V8ToIstanbul { } this.branches[path] = this.branches[path] || [] this.branches[path].forEach((branch, index) => { - const ignore = source.lines[branch.startLine - 1].ignore + const srcLine = source.lines[branch.startLine - 1] + const ignore = srcLine === undefined ? true : srcLine.ignore branches.branchMap[`${index}`] = branch.toIstanbul() branches.b[`${index}`] = [ignore ? 1 : branch.count] }) @@ -271,7 +272,8 @@ module.exports = class V8ToIstanbul { } this.functions[path] = this.functions[path] || [] this.functions[path].forEach((fn, index) => { - const ignore = source.lines[fn.startLine - 1].ignore + const srcLine = source.lines[fn.startLine - 1] + const ignore = srcLine === undefined ? true : srcLine.ignore functions.fnMap[`${index}`] = fn.toIstanbul() functions.f[`${index}`] = ignore ? 1 : fn.count })