We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ed774b7 commit fe9888aCopy full SHA for fe9888a
test/parallel/test-worker-type-check.js
@@ -0,0 +1,28 @@
1
+// Flags: --experimental-worker
2
+'use strict';
3
+
4
+const common = require('../common');
5
+const { Worker } = require('worker_threads');
6
7
+{
8
+ [
9
+ undefined,
10
+ null,
11
+ false,
12
+ 0,
13
+ Symbol('test'),
14
+ {},
15
+ [],
16
+ () => {}
17
+ ].forEach((val) => {
18
+ common.expectsError(
19
+ () => new Worker(val),
20
+ {
21
+ code: 'ERR_INVALID_ARG_TYPE',
22
+ type: TypeError,
23
+ message: 'The "filename" argument must be of type string. ' +
24
+ `Received type ${typeof val}`
25
+ }
26
+ );
27
+ });
28
+}
0 commit comments