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'); }));