node/test/parallel/test-process-execve-worker-threads.js
Antoine du Hamel 634dc26605
test: ensure assertions are reached on all tests
PR-URL: https://github.com/nodejs/node/pull/60845
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
2025-11-27 09:35:25 +00:00

22 lines
600 B
JavaScript

'use strict';
const { isWindows, isIBMi, mustCall, skip } = require('../common');
const assert = require('assert');
const { isMainThread, Worker } = require('worker_threads');
if (isWindows || isIBMi) {
skip('process.execve is not available in Windows or IBM i');
}
if (isMainThread) {
new Worker(__filename);
} else {
assert.throws(mustCall(() => {
process.execve(
process.execPath,
[__filename, 'replaced'],
{ ...process.env, EXECVE_A: 'FIRST', EXECVE_B: 'SECOND', CWD: process.cwd() }
);
}), { name: 'TypeError', code: 'ERR_WORKER_UNSUPPORTED_OPERATION' });
}