Skip to content

Commit

Permalink
test: check type for Worker filename argument
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Masashi Hirano authored and targos committed Jul 4, 2018
1 parent ed774b7 commit fe9888a
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test/parallel/test-worker-type-check.js
Original file line number Diff line number Diff line change
@@ -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}`
}
);
});
}

0 comments on commit fe9888a

Please sign in to comment.