Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
test: check type for Worker filename argument
Add test to check type for first argument of Worker to increase
coverage.
  • Loading branch information
Masashi Hirano committed Jul 1, 2018
commit 28e8d29af4fc65d1ecbd294d2c9c5e762566563d
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}`
}
);
});
}