Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 76c2f4f

Browse filesBrowse files
Trottrvagg
authored andcommitted
test: simplify test-worker-syntax-error
Remove extraneous code from test-worker-syntax-error. Because the worker is called with `eval: true`, there is no need to set an environment variable indicating whether the worker has started and so on. The test file is only ever executed by the main thread. PR-URL: #26144 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent dab3d71 commit 76c2f4f
Copy full SHA for 76c2f4f

File tree

Expand file treeCollapse file tree

1 file changed

+6
-12
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-12
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-worker-syntax-error.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-worker-syntax-error.js
+6-12Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,9 @@ const common = require('../common');
33
const assert = require('assert');
44
const { Worker } = require('worker_threads');
55

6-
// Do not use isMainThread so that this test itself can be run inside a Worker.
7-
if (!process.env.HAS_STARTED_WORKER) {
8-
process.env.HAS_STARTED_WORKER = 1;
9-
const w = new Worker('abc)', { eval: true });
10-
w.on('message', common.mustNotCall());
11-
w.on('error', common.mustCall((err) => {
12-
assert.strictEqual(err.constructor, SyntaxError);
13-
assert(/SyntaxError/.test(err));
14-
}));
15-
} else {
16-
throw new Error('foo');
17-
}
6+
const w = new Worker('abc)', { eval: true });
7+
w.on('message', common.mustNotCall());
8+
w.on('error', common.mustCall((err) => {
9+
assert.strictEqual(err.constructor, SyntaxError);
10+
assert(/SyntaxError/.test(err));
11+
}));

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.