From c5fed536328afb251aac49de870594e3568c7518 Mon Sep 17 00:00:00 2001 From: Onur Temizkan Date: Tue, 18 Jul 2023 12:17:18 +0100 Subject: [PATCH] test(remix): Test Remix SDK on Node 20. --- .github/workflows/build.yml | 2 +- packages/node-integration-tests/utils/index.ts | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a5523a861eee..0c024683bd4e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -706,7 +706,7 @@ jobs: strategy: fail-fast: false matrix: - node: [14, 16, 18] + node: [14, 16, 18, 20] remix: [1, 2] steps: - name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }}) diff --git a/packages/node-integration-tests/utils/index.ts b/packages/node-integration-tests/utils/index.ts index 88120853ee69..287a8f4e8ece 100644 --- a/packages/node-integration-tests/utils/index.ts +++ b/packages/node-integration-tests/utils/index.ts @@ -127,6 +127,16 @@ export class TestEnv { public constructor(public readonly server: http.Server, public readonly url: string) { this.server = server; this.url = url; + + // We need to destroy the socket after the response has been sent + // to prevent the server.close (called inside nock interceptor) from hanging in tests. + // Otherwise the tests may timeout. (Happening on Node 20) + // See: https://github.com/nodejs/node/issues/2642 + this.server.on('request', (req, res) => { + res.on('finish', () => { + req.socket.destroy(); + }); + }); } /**