Compare commits

...

1 Commits

Author SHA1 Message Date
Meghan Denny
95b5e7c55b node: fix test-worker-terminate-unrefed.js 2025-07-17 19:39:36 -07:00

View File

@@ -0,0 +1,16 @@
'use strict';
const common = require('../common');
const { once } = require('events');
const { Worker } = require('worker_threads');
// Test that calling worker.terminate() on an unref()ed Worker instance
// still resolves the returned Promise.
async function test() {
const worker = new Worker('setTimeout(() => {}, 1000000);', { eval: true });
await once(worker, 'online');
worker.unref();
await worker.terminate();
}
test().then(common.mustCall());