Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
test: remove unnecessary process.exit calls from test files
  • Loading branch information
aduh95 committed Feb 27, 2026
commit d0a22f912faa8c272575e0baadf5733de7bbbea8
6 changes: 2 additions & 4 deletions benchmark/buffers/buffer-transcode.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ const common = require('../common.js');
const assert = require('node:assert');
const buffer = require('node:buffer');

const hasIntl = !!process.config.variables.v8_enable_i18n_support;
const encodings = ['latin1', 'ascii', 'ucs2', 'utf8'];

if (!hasIntl) {
console.log('Skipping: `transcode` is only available on platforms that support i18n`');
process.exit(0);
if (!common.hasIntl) {
common.skip('`transcode` is only available on platforms that support i18n`');
}

const bench = common.createBenchmark(main, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ if (process.argv[2] === 'child-buffer') {
v & 0xFF,
]);
const fd = process.channel?.fd;
if (fd === undefined) {
// skip test
process.exit(0);
if (fd !== undefined) {
fs.writeSync(fd, payload);
}
fs.writeSync(fd, payload);
return;
}

Expand Down
3 changes: 0 additions & 3 deletions test/parallel/test-child-process-internal.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ if (process.argv[2] === 'child') {

// Send internal message
process.send(internal);

process.exit(0);

} else {

const fork = require('child_process').fork;
Expand Down
6 changes: 2 additions & 4 deletions test/parallel/test-child-process-silent.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.

'use strict';
require('../common');
const common = require('../common');
const assert = require('assert');
const childProcess = require('child_process');

Expand All @@ -44,9 +44,7 @@ if (process.argv[2] === 'pipe') {
// Allow child process to self terminate
child.disconnect();

child.on('exit', function() {
process.exit(0);
});
child.on('exit', common.mustCall());

} else {
// Testcase | start primary && child IPC test
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-child-process-spawnsync-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ if (process.argv.includes('spawnchild')) {
checkSpawnSyncRet(ret);
break;
}
process.exit(0);
return;
}

Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-child-process-stdout-flush-exit.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ if (process.argv[2] === 'child') {
console.log('filler');
}
console.log('goodbye');
process.exit(0);
} else {
// parent process
const spawn = require('child_process').spawn;
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-cli-eval.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const fixtures = require('../common/fixtures');

if (process.argv.length > 2) {
console.log(process.argv.slice(2).join(' '));
process.exit(0);
return;
}

// Assert that nothing is written to stdout.
Expand Down
2 changes: 0 additions & 2 deletions test/parallel/test-inspector-port-zero-cluster.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// Flags: --inspect=0
'use strict';
const common = require('../common');
Expand Down Expand Up @@ -50,6 +50,4 @@
console.error(err);
process.exit(1);
});
} else {
process.exit(0);
}
2 changes: 1 addition & 1 deletion test/parallel/test-net-listen-twice.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if (cluster.isPrimary) {
server.listen();
} catch (e) {
console.error(e);
process.exit(0);
return;
}
let i = 0;
process.on('internalMessage', (msg) => {
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-permission-allow-child-process-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if (process.argv[2] === 'child') {
code: 'ERR_ACCESS_DENIED',
permission: 'FileSystemWrite',
}));
process.exit(0);
return;
}

// Guarantee the initial state
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-permission-allow-worker-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const assert = require('assert');
const { isMainThread, Worker } = require('worker_threads');

if (!isMainThread) {
process.exit(0);
return;
}

// Guarantee the initial state
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-permission-child-process-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const assert = require('assert');
const childProcess = require('child_process');

if (process.argv[2] === 'child') {
process.exit(0);
return;
}

// Guarantee the initial state
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-process-env.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ if (process.argv[2] === 'you-are-the-child') {
assert.strictEqual(process.env[42], 'forty-two');
const has = Object.hasOwn(process.env, 'hasOwnProperty');
assert.strictEqual(has, true);
process.exit(0);
return;
}

{
Expand Down
3 changes: 1 addition & 2 deletions test/parallel/test-runner-run-files-undefined.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import { fork } from 'node:child_process';
import assert from 'node:assert';

if (common.hasCrypto) {
console.log('1..0 # Skipped: no crypto');
process.exit(0);
common.skip('no crypto');
}
Comment thread
aduh95 marked this conversation as resolved.

if (process.env.CHILD === 'true') {
Expand Down
18 changes: 7 additions & 11 deletions test/parallel/test-trace-exit.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,22 @@ const { Worker, isMainThread, workerData } = require('worker_threads');

const variant = process.argv[process.argv.length - 1];
switch (true) {
case variant === 'main-thread': {
return;
}
case variant === 'main-thread-exit': {
case isMainThread ? variant === 'main-thread-exit' : workerData === 'worker-thread-exit':
return process.exit(0);
}
case variant.startsWith('worker-thread'): {
const worker = new Worker(__filename, { workerData: variant });
worker.on('error', common.mustNotCall());
worker.on('exit', common.mustCall((code) => {
assert.strictEqual(code, 0);
}));
return;
}
case !isMainThread: {
if (workerData === 'worker-thread-exit') {
process.exit(0);
}
// eslint-disable-next-line no-fallthrough
case variant === 'main-thread':
// eslint-disable-next-line no-fallthrough
case variant === 'main-thread-exit':
// eslint-disable-next-line no-fallthrough
case !isMainThread:
return;
}
}

(async function() {
Expand Down
2 changes: 0 additions & 2 deletions test/parallel/test-worker-safe-getters.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,4 @@ if (isMainThread) {
assert.strictEqual(w.stdout, stdout);
assert.strictEqual(w.stderr, stderr);
}));
} else {
process.exit(0);
}
1 change: 0 additions & 1 deletion test/parallel/test-worker-stdio-flush-inflight.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@ if (isMainThread) {
process.stdout.write('hello');
process.stdout.write(' ');
process.stdout.write('world');
process.exit(0);
}
1 change: 0 additions & 1 deletion test/parallel/test-worker-thread-name.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const name = 'test-worker-thread-name';

if (workerData?.isWorker) {
assert.strictEqual(threadName, name);
process.exit(0);
} else {
const w = new Worker(__filename, { name, workerData: { isWorker: true } });
assert.strictEqual(w.threadName, name);
Expand Down
Loading