summaryrefslogtreecommitdiff
path: root/test/parallel/test-worker-esm-missing-main.js
blob: 51dba34a7916c78e55e70c9d96cf11cbfbc511d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
'use strict';
const common = require('../common');
const assert = require('assert');
const path = require('path');
const { Worker } = require('worker_threads');

const tmpdir = require('../common/tmpdir');
tmpdir.refresh();
const missing = path.join(tmpdir.path, 'does-not-exist.js');

const worker = new Worker(missing);

worker.on('error', common.mustCall((err) => {
  // eslint-disable-next-line node-core/no-unescaped-regexp-dot
  assert.match(err.message, /Cannot find module .+does-not-exist.js/);
}));