Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit aa0c7b0

Browse filesBrowse files
aduh95richardlau
authored andcommitted
test: remove unnecessary process.exit calls from test files
PR-URL: #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>
1 parent ad96a65 commit aa0c7b0
Copy full SHA for aa0c7b0

17 files changed

+22-43Lines changed: 22 additions & 43 deletions
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎benchmark/buffers/buffer-transcode.js‎

Copy file name to clipboardExpand all lines: benchmark/buffers/buffer-transcode.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const encodings = ['latin1', 'ascii', 'ucs2', 'utf8'];
88

99
if (!hasIntl) {
1010
console.log('Skipping: `transcode` is only available on platforms that support i18n`');
11-
process.exit(0);
11+
return;
1212
}
1313

1414
const bench = common.createBenchmark(main, {
Collapse file

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

Copy file name to clipboardExpand all lines: test/parallel/test-child-process-fork-advanced-header-serialization.js
+2-4Lines 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

Collapse file

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

Copy file name to clipboardExpand all lines: test/parallel/test-child-process-internal.js
-3Lines 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;
Collapse file

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

Copy file name to clipboardExpand all lines: test/parallel/test-child-process-silent.js
+2-4Lines 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
Collapse file

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

Copy file name to clipboardExpand all lines: test/parallel/test-child-process-spawnsync-input.js
-1Lines 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

Collapse file

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

Copy file name to clipboardExpand all lines: test/parallel/test-child-process-stdout-flush-exit.js
-1Lines 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;
Collapse file

‎test/parallel/test-cli-eval.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-cli-eval.js
+1-1Lines 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.
Collapse file

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

Copy file name to clipboardExpand all lines: test/parallel/test-inspector-port-zero-cluster.js
+4-8Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function serialFork() {
3535

3636
if (cluster.isPrimary) {
3737
Promise.all([serialFork(), serialFork(), serialFork()])
38-
.then(common.mustCall((ports) => {
38+
.then((ports) => {
3939
ports.splice(0, 0, process.debugPort);
4040
// 4 = [primary, worker1, worker2, worker3].length()
4141
assert.strictEqual(ports.length, 4);
@@ -44,12 +44,8 @@ if (cluster.isPrimary) {
4444
assert.strictEqual(ports[0] === 65535 ? 1024 : ports[0] + 1, ports[1]);
4545
assert.strictEqual(ports[1] === 65535 ? 1024 : ports[1] + 1, ports[2]);
4646
assert.strictEqual(ports[2] === 65535 ? 1024 : ports[2] + 1, ports[3]);
47-
}))
48-
.catch(
49-
(err) => {
50-
console.error(err);
51-
process.exit(1);
52-
});
47+
})
48+
.then(common.mustCall());
5349
} else {
54-
process.exit(0);
50+
process.disconnect();
5551
}
Collapse file

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

Copy file name to clipboardExpand all lines: test/parallel/test-net-listen-twice.js
+1-1Lines 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) => {
Collapse file

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

Copy file name to clipboardExpand all lines: test/parallel/test-permission-allow-child-process-cli.js
+1-1Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.