From 6ed912dd0319475d2c4ebd9991af52420de17fe8 Mon Sep 17 00:00:00 2001 From: himself65 Date: Fri, 27 Mar 2020 00:54:52 +0800 Subject: [PATCH] test: fix check error name on error instance PR-URL: https://github.com/nodejs/node/pull/32508 Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: James M Snell --- test/parallel/test-worker-syntax-error-file.js | 2 +- test/parallel/test-worker-syntax-error.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-worker-syntax-error-file.js b/test/parallel/test-worker-syntax-error-file.js index ca42c174808500..36b8913895dfa2 100644 --- a/test/parallel/test-worker-syntax-error-file.js +++ b/test/parallel/test-worker-syntax-error-file.js @@ -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'); diff --git a/test/parallel/test-worker-syntax-error.js b/test/parallel/test-worker-syntax-error.js index 1c1fbf1c1ab3a0..99ebf26a9fa714 100644 --- a/test/parallel/test-worker-syntax-error.js +++ b/test/parallel/test-worker-syntax-error.js @@ -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'); }));