From 6ff69baea8c18544b8aebda389fe1851dd6d5fdf Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Mon, 17 Aug 2026 15:03:06 +0200 Subject: [PATCH] test: enforce exit code in `test-http-server-stale-close` Signed-off-by: Antoine du Hamel PR-URL: https://github.com/nodejs/node/pull/65198 Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig --- test/parallel/test-http-server-stale-close.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/test/parallel/test-http-server-stale-close.js b/test/parallel/test-http-server-stale-close.js index d33c756a4a3..909d02c920e 100644 --- a/test/parallel/test-http-server-stale-close.js +++ b/test/parallel/test-http-server-stale-close.js @@ -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); + })); + })); }