summaryrefslogtreecommitdiff
path: root/test/parallel/test-worker-dns-terminate.js
blob: da9d543c3b0be2903ab30726f8e34cacfd0848c8 (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().then(common.mustCall());
}));