summaryrefslogtreecommitdiff
path: root/test/parallel/test-worker-type-check.js
blob: 964755603548979d487523e85affccd8ce6aaa57 (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
'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}`
      }
    );
  });
}