Skip to content

Commit 2f34d5f

Browse files
targosMylesBorins
authored andcommitted
assert: fix it
1 parent ac0ebae commit 2f34d5f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/assert.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ function getErrMessage(message, fn) {
267267
Error.prepareStackTrace = tmpPrepare;
268268

269269
const filename = call.getFileName();
270-
const line = call.getLineNumber() - 1;
270+
let line = call.getLineNumber() - 1;
271271
let column = call.getColumnNumber() - 1;
272272
let identifier;
273273
let code;
@@ -287,6 +287,9 @@ function getErrMessage(message, fn) {
287287
return message;
288288
}
289289
code = String(fn);
290+
// For functions created with the Function constructor, V8 does not count
291+
// the lines containing the function header.
292+
line += 2;
290293
identifier = `${code}${line}${column}`;
291294
}
292295

0 commit comments

Comments
 (0)