Skip to content

Commit d0a22f9

Browse files
committed
test: remove unnecessary process.exit calls from test files
1 parent 2ae6d8f commit d0a22f9

18 files changed

+20
-42
lines changed

benchmark/buffers/buffer-transcode.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@ const common = require('../common.js');
33
const assert = require('node:assert');
44
const buffer = require('node:buffer');
55

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

9-
if (!hasIntl) {
10-
console.log('Skipping: `transcode` is only available on platforms that support i18n`');
11-
process.exit(0);
8+
if (!common.hasIntl) {
9+
common.skip('`transcode` is only available on platforms that support i18n`');
1210
}
1311

1412
const bench = common.createBenchmark(main, {

test/parallel/test-child-process-fork-advanced-header-serialization.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,9 @@ if (process.argv[2] === 'child-buffer') {
1313
v & 0xFF,
1414
]);
1515
const fd = process.channel?.fd;
16-
if (fd === undefined) {
17-
// skip test
18-
process.exit(0);
16+
if (fd !== undefined) {
17+
fs.writeSync(fd, payload);
1918
}
20-
fs.writeSync(fd, payload);
2119
return;
2220
}
2321

test/parallel/test-child-process-internal.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ if (process.argv[2] === 'child') {
3434

3535
// Send internal message
3636
process.send(internal);
37-
38-
process.exit(0);
39-
4037
} else {
4138

4239
const fork = require('child_process').fork;

test/parallel/test-child-process-silent.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
// USE OR OTHER DEALINGS IN THE SOFTWARE.
2121

2222
'use strict';
23-
require('../common');
23+
const common = require('../common');
2424
const assert = require('assert');
2525
const childProcess = require('child_process');
2626

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

47-
child.on('exit', function() {
48-
process.exit(0);
49-
});
47+
child.on('exit', common.mustCall());
5048

5149
} else {
5250
// Testcase | start primary && child IPC test

test/parallel/test-child-process-spawnsync-input.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ if (process.argv.includes('spawnchild')) {
6565
checkSpawnSyncRet(ret);
6666
break;
6767
}
68-
process.exit(0);
6968
return;
7069
}
7170

test/parallel/test-child-process-stdout-flush-exit.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ if (process.argv[2] === 'child') {
3636
console.log('filler');
3737
}
3838
console.log('goodbye');
39-
process.exit(0);
4039
} else {
4140
// parent process
4241
const spawn = require('child_process').spawn;

test/parallel/test-cli-eval.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const fixtures = require('../common/fixtures');
3535

3636
if (process.argv.length > 2) {
3737
console.log(process.argv.slice(2).join(' '));
38-
process.exit(0);
38+
return;
3939
}
4040

4141
// Assert that nothing is written to stdout.

test/parallel/test-inspector-port-zero-cluster.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,4 @@ if (cluster.isPrimary) {
5050
console.error(err);
5151
process.exit(1);
5252
});
53-
} else {
54-
process.exit(0);
5553
}

test/parallel/test-net-listen-twice.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ if (cluster.isPrimary) {
1919
server.listen();
2020
} catch (e) {
2121
console.error(e);
22-
process.exit(0);
22+
return;
2323
}
2424
let i = 0;
2525
process.on('internalMessage', (msg) => {

test/parallel/test-permission-allow-child-process-cli.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ if (process.argv[2] === 'child') {
2424
code: 'ERR_ACCESS_DENIED',
2525
permission: 'FileSystemWrite',
2626
}));
27-
process.exit(0);
27+
return;
2828
}
2929

3030
// Guarantee the initial state

0 commit comments

Comments
 (0)