summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/assert.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/assert.js b/lib/assert.js
index a83dba770e..d307582d1f 100644
--- a/lib/assert.js
+++ b/lib/assert.js
@@ -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;
@@ -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}`;
}