Skip to content

Commit

Permalink
assert: fix line number calculation after V8 upgrade
Browse files Browse the repository at this point in the history
PR-URL: #29694
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Gus Caplan <[email protected]>
Reviewed-By: Jiawen Geng <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Ujjwal Sharma <[email protected]>
  • Loading branch information
targos authored and MylesBorins committed Oct 7, 2019
1 parent 1676502 commit 5981fb7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ function getErrMessage(message, fn) {
const call = err.stack[0];

const filename = call.getFileName();
const line = call.getLineNumber() - 1;
let line = call.getLineNumber() - 1;
let column = call.getColumnNumber() - 1;
let identifier;
let code;
Expand All @@ -289,6 +289,9 @@ function getErrMessage(message, fn) {
return message;
}
code = String(fn);
// For functions created with the Function constructor, V8 does not count
// the lines containing the function header.
line += 2;
identifier = `${code}${line}${column}`;
}

Expand Down

0 comments on commit 5981fb7

Please sign in to comment.