test: fix check error name on error instance

PR-URL: https://github.com/nodejs/node/pull/32508
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
himself65
2020-03-27 00:54:52 +08:00
committed by James M Snell
parent fd2b35c576
commit 6ed912dd03
2 changed files with 2 additions and 2 deletions

View File

@@ -11,7 +11,7 @@ if (!process.env.HAS_STARTED_WORKER) {
w.on('message', common.mustNotCall());
w.on('error', common.mustCall((err) => {
assert.strictEqual(err.constructor, SyntaxError);
assert(/SyntaxError/.test(err));
assert.strictEqual(err.name, 'SyntaxError');
}));
} else {
throw new Error('foo');

View File

@@ -7,5 +7,5 @@ const w = new Worker('abc)', { eval: true });
w.on('message', common.mustNotCall());
w.on('error', common.mustCall((err) => {
assert.strictEqual(err.constructor, SyntaxError);
assert(/SyntaxError/.test(err));
assert.strictEqual(err.name, 'SyntaxError');
}));