Skip to content

Commit

Permalink
test: do not force the process to exit
Browse files Browse the repository at this point in the history
Using `process.exit()` in these tests is unnecessary and may mask other
problems.

Refs: #29873 (review)

PR-URL: #29923
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Jeremiah Senkpiel <[email protected]>
Reviewed-By: David Carlier <[email protected]>
Reviewed-By: Anto Aravinth <[email protected]>
Reviewed-By: Yongsheng Zhang <[email protected]>
  • Loading branch information
lpinca authored and Trott committed Oct 13, 2019
1 parent 02b3722 commit 19a8d22
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 10 deletions.
1 change: 0 additions & 1 deletion test/parallel/test-cluster-net-send.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ if (process.argv[2] !== 'child') {
});

process.on('disconnect', function() {
process.exit();
server.close();
});
}
1 change: 0 additions & 1 deletion test/parallel/test-http-date-header.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ server.addListener('listening', () => {
'Response headers didn\'t contain a Date.');
res.addListener('end', () => {
server.close();
process.exit();
});
res.resume();
});
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-http-expect-continue.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ server.on('listening', common.mustCall(() => {
assert.strictEqual(body, test_res_body);
assert.ok('abcd' in res.headers, 'Response headers missing.');
server.close();
process.exit();
}));
}));
}));
1 change: 0 additions & 1 deletion test/parallel/test-http-localaddress.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ server.listen(0, '127.0.0.1', () => {
const req = http.request(options, function(res) {
res.on('end', () => {
server.close();
process.exit();
});
res.resume();
});
Expand Down
3 changes: 0 additions & 3 deletions test/parallel/test-http-set-trailers.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ server.on('listening', function() {
outstanding_reqs--;
if (outstanding_reqs === 0) {
server.close();
process.exit();
}
});
});
Expand Down Expand Up @@ -91,7 +90,6 @@ server.on('listening', function() {
);
if (outstanding_reqs === 0) {
server.close();
process.exit();
}
}
});
Expand All @@ -110,7 +108,6 @@ server.on('listening', function() {
outstanding_reqs--;
if (outstanding_reqs === 0) {
server.close();
process.exit();
}
});
res.resume();
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-https-localaddress.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ server.listen(0, '127.0.0.1', function() {
const req = https.request(options, function(res) {
res.on('end', function() {
server.close();
process.exit();
});
res.resume();
});
Expand Down
7 changes: 6 additions & 1 deletion test/parallel/test-https-timeout.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,15 @@ const server = https.createServer(options, function() {
console.log('got response');
});

req.on('error', common.expectsError({
message: 'socket hang up',
code: 'ECONNRESET',
type: Error
}));

req.on('timeout', common.mustCall(function() {
console.log('timeout occurred outside');
req.destroy();
server.close();
process.exit(0);
}));
}));
1 change: 0 additions & 1 deletion test/parallel/test-timers-non-integer-delay.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ let N = 50;
const interval = setInterval(common.mustCall(() => {
if (--N === 0) {
clearInterval(interval);
process.exit(0);
}
}, N), TIMEOUT_DELAY);

Expand Down

0 comments on commit 19a8d22

Please sign in to comment.