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

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

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