test: enforce exit code in test-http-server-stale-close

Signed-off-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/65198
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
Antoine du Hamel committed 2026-08-27 14:17:06 +02:00
1 parent 64c20b449e
commit 6ff69baea8
1 file changed
+8 -4
@@ -35,7 +35,7 @@ if (process.env.NODE_TEST_FORK_PORT) {
req.write('BAM');
req.end();
} else {
const server = http.createServer(common.mustCallAtLeast((req, res) => {
const server = http.createServer(common.mustCall((req, res) => {
res.writeHead(200, { 'Content-Length': '42' });
req.pipe(res);
assert.strictEqual(req.destroyed, false);
@@ -45,9 +45,13 @@ if (process.env.NODE_TEST_FORK_PORT) {
res.end();
}));
}));
server.listen(0, function() {
fork(__filename, {
server.listen(0, common.mustCall(function() {
const cp = fork(__filename, {
stdio: 'inherit',
env: { ...process.env, NODE_TEST_FORK_PORT: this.address().port }
});
});
cp.once('exit', common.mustCall((code) => {
assert.strictEqual(code, 0);
}));
}));
}