aboutsummaryrefslogtreecommitdiff
path: root/test/parallel/test-worker-esm-missing-main.js
blob: 8f4cfb0fe7fa9b408914da0db46bd3f1fc5b7bba (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, { execArgv: ['--experimental-modules'] });

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