Skip to content

Commit f7f9347

Browse files
committed
test: update Error.stack test for V8 7.5
V8 7.5 changed how it caches the stringified stack on Error objects after the first access. Instead of replacing the accessor Error.stack with the stringified stack, the stringified stack is stored in the same Symbol which was used to store the FrameArray stack. Ref: v8/v8@c820604 PR-URL: #327 Refs: v8/v8@c820604 Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent 37b3c26 commit f7f9347

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

test/plugin/inspect-test.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,11 @@ const hashMapTests = {
173173
if (err) return cb(err);
174174
lines = lines.join('\n');
175175

176-
let strStackMatch = lines.match(/stack=(0x[0-9a-f]+):<String: /i);
176+
// NOTE(mmarchini): V8 7.5 replaces the internal symbol with a string
177+
// instead of the .stack accessor to avoid creating a new Map for each
178+
// Error with stringified stack.
179+
// https://github.com/v8/v8/commit/c8206043e1afb6d179a68bb5a8c079de5e76a010
180+
let strStackMatch = lines.match(/(Symbol\(\)|stack)=(0x[0-9a-f]+):<String: /i);
177181
t.ok(strStackMatch, 'hashmap.stringifiedError should have stringified stack');
178182

179183
let stackMatch = lines.match(/error stack {/i);

0 commit comments

Comments
 (0)