aboutsummaryrefslogtreecommitdiff
path: root/test/parallel/test-worker-type-check.js
blob: 88965f4be4c62d500713bb493708fb9e6b5b0f8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
'use strict';

const common = require('../common');
const assert = require('assert');
const { Worker } = require('worker_threads');

{
  [
    undefined,
    null,
    false,
    0,
    Symbol('test'),
    {},
    [],
    () => {}
  ].forEach((val) => {
    assert.throws(
      () => new Worker(val),
      {
        code: 'ERR_INVALID_ARG_TYPE',
        name: 'TypeError',
        message: 'The "filename" argument must be of type string ' +
                 'or an instance of URL.' +
                 common.invalidArgTypeHelper(val)
      }
    );
  });
}