Skip to content

Commit fe9888a

Browse files
Masashi Hiranotargos
Masashi Hirano
authored andcommitted
test: check type for Worker filename argument
Add test to check type for first argument of Worker to increase coverage. PR-URL: #21620 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Minwoo Jung <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
1 parent ed774b7 commit fe9888a

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
+28
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)