node/test/parallel/test-worker-thread-name.js
Antoine du Hamel f951acf624
test: remove unnecessary process.exit calls from test files
PR-URL: https://github.com/nodejs/node/pull/62020
Reviewed-By: Jacob Smith <jacob@frende.me>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2026-03-01 11:33:00 +00:00

17 lines
487 B
JavaScript

'use strict';
const common = require('../common');
const assert = require('assert');
const { Worker, threadName, workerData } = require('worker_threads');
const name = 'test-worker-thread-name';
if (workerData?.isWorker) {
assert.strictEqual(threadName, name);
} else {
const w = new Worker(__filename, { name, workerData: { isWorker: true } });
assert.strictEqual(w.threadName, name);
w.on('exit', common.mustCall(() => {
assert.strictEqual(w.threadName, null);
}));
}