1'use strict';
2const common = require('../common');
3const { once } = require('events');
4const { Worker } = require('worker_threads');
5
6// Test that calling worker.terminate() on an unref()’ed Worker instance
7// still resolves the returned Promise.
8
9async function test() {
10  const worker = new Worker('setTimeout(() => {}, 1000000);', { eval: true });
11  await once(worker, 'online');
12  worker.unref();
13  await worker.terminate();
14}
15
16test().then(common.mustCall());
17