mirror of
https://github.com/nodejs/node.git
synced 2026-10-14 10:26:26 -04:00
test: check type for Worker filename argument
Add test to check type for first argument of Worker to increase coverage. PR-URL: https://github.com/nodejs/node/pull/21620 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
This commit is contained in:
1 parent
f374d6aaf9
commit
0b2ad91ad3
1 file changed
+28
@@ -0,0 +1,28 @@
|
||||
// Flags: --experimental-worker
|
||||
'use strict';
|
||||
|
||||
const common = require('../common');
|
||||
const { Worker } = require('worker_threads');
|
||||
|
||||
{
|
||||
[
|
||||
undefined,
|
||||
null,
|
||||
false,
|
||||
0,
|
||||
Symbol('test'),
|
||||
{},
|
||||
[],
|
||||
() => {}
|
||||
].forEach((val) => {
|
||||
common.expectsError(
|
||||
() => new Worker(val),
|
||||
{
|
||||
code: 'ERR_INVALID_ARG_TYPE',
|
||||
type: TypeError,
|
||||
message: 'The "filename" argument must be of type string. ' +
|
||||
`Received type ${typeof val}`
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user