Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: undefined line in branches and functions #139

Merged
merged 1 commit into from May 5, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/v8-to-istanbul.js
Expand Up @@ -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]
})
Expand All @@ -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
})
Expand Down