From f23010d837e484fcb50db8c6bc9331e64b5414ea Mon Sep 17 00:00:00 2001 From: Filip Skokan Date: Sat, 26 Sep 2026 13:02:20 +0200 Subject: [PATCH] test: deflake esm loader http imports Keep idle server connections open until the client closes them. This avoids reusing a keep-alive socket the server closed while the loader thread was stalled. Refs: https://github.com/nodejs/node/issues/47836 Signed-off-by: Filip Skokan Assisted-by: Claude, Codex PR-URL: https://github.com/nodejs/node/pull/66320 Reviewed-By: James M Snell Reviewed-By: Antoine du Hamel --- test/es-module/es-module.status | 4 ---- test/es-module/test-esm-loader-http-imports.mjs | 4 +++- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/test/es-module/es-module.status b/test/es-module/es-module.status index 376b9cdeb07..2e18fb7c96a 100644 --- a/test/es-module/es-module.status +++ b/test/es-module/es-module.status @@ -6,10 +6,6 @@ prefix es-module [true] # This section applies to all platforms -[$system==linux || $system==freebsd] -# https://github.com/nodejs/node/issues/47836 -test-esm-loader-http-imports: PASS,FLAKY - [$arch==arm || $arch==arm64] # https://github.com/nodejs/node/issues/47297 test-wasm-web-api: SKIP diff --git a/test/es-module/test-esm-loader-http-imports.mjs b/test/es-module/test-esm-loader-http-imports.mjs index 07e84eddd86..96bfffe5b13 100644 --- a/test/es-module/test-esm-loader-http-imports.mjs +++ b/test/es-module/test-esm-loader-http-imports.mjs @@ -34,7 +34,9 @@ const requestListener = ({ url }, rsp) => { .end(); }; -const server = http.createServer(requestListener); +// Leave closing idle connections to the client, so that the loader never +// reuses a keep-alive socket the server has just closed. +const server = http.createServer({ keepAliveTimeout: 0 }, requestListener); await promisify(server.listen.bind(server))({ host: '127.0.0.1',