summaryrefslogtreecommitdiff
path: root/test/parallel/test-worker-dns-terminate.js
blob: 079a29d52e09a3463e429f6fe676f1b6f8fffe32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const { Worker } = require('worker');

const w = new Worker(`
const dns = require('dns');
dns.lookup('nonexistent.org', () => {});
require('worker').parentPort.postMessage('0');
`, { eval: true });

w.on('message', common.mustCall(() => {
  // This should not crash the worker during a DNS request.
  w.terminate(common.mustCall());
}));