Skip to content

Commit 6fdfd26

Browse files
Matheus Marchinimmarchini
Matheus Marchini
authored andcommitted
fixup! src: fix JSError inspection
1 parent 22588cc commit 6fdfd26

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

test/plugin/inspect-test.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,24 @@ const hashMapTests = {
136136
// .error=0x0000392d5d661119:<Object: Error>
137137
'error': {
138138
re: /.error=(0x[0-9a-f]+):<Object: Error>/,
139-
desc: '.error Error property'
139+
desc: '.error Error property',
140+
validator(t, sess, addresses, name, cb) {
141+
const address = addresses[name];
142+
sess.send(`v8 inspect ${address}`);
143+
144+
sess.linesUntil(/}>/, (err, lines) => {
145+
if (err) return cb(err);
146+
lines = lines.join('\n');
147+
148+
let codeMatch = lines.match(/code=(0x[0-9a-f]+):<String: "ERR_TEST">/i);
149+
t.ok(codeMatch, 'hashmap.error.code should be "ERR_TEST"');
150+
151+
let errnoMatch = lines.match(/errno=<Smi: 1>/i);
152+
t.ok(errnoMatch, 'hashmap.error.errno should be 1');
153+
154+
cb(null);
155+
});
156+
}
140157
},
141158
// .array=0x000003df9cbe7919:<Array: length=6>,
142159
'array': {

0 commit comments

Comments
 (0)