From 73ea3e4cce86f1916097710d1d314e1a2c02627b Mon Sep 17 00:00:00 2001 From: David Glasser Date: Tue, 9 Jul 2024 23:49:10 -0700 Subject: [PATCH] Fix test failure with Node 18.20.3 (#7898) Our CI installs the latest version associated with a given Node version, so it started to fail when this started loading v18.20.3 which reverted the change backported to v18.19. --- .changeset/four-dogs-brake.md | 2 ++ .../__tests__/plugin/drainHttpServer/stoppable.test.ts | 10 ++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 .changeset/four-dogs-brake.md diff --git a/.changeset/four-dogs-brake.md b/.changeset/four-dogs-brake.md new file mode 100644 index 00000000000..a845151cc84 --- /dev/null +++ b/.changeset/four-dogs-brake.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/packages/server/src/__tests__/plugin/drainHttpServer/stoppable.test.ts b/packages/server/src/__tests__/plugin/drainHttpServer/stoppable.test.ts index 4f26e35a2f4..c95b50d76e3 100644 --- a/packages/server/src/__tests__/plugin/drainHttpServer/stoppable.test.ts +++ b/packages/server/src/__tests__/plugin/drainHttpServer/stoppable.test.ts @@ -141,11 +141,13 @@ Object.keys(schemes).forEach((schemeName) => { // idle connections in these versions. However, `Stopper` _is_ still // useful for gracefully finishing in-flight requests within the timeout // (and aborting requests beyond the timeout). - // Update: Node 18.19+ had this change backported, so the comment from above - // applies to Node 18.19+ as well. - const isNode18 = !!process.version.match(/^v18\./); + // + // (Node 18.19.0 had this change backported but it was removed again in + // 18.20.3; our tests only pin major versions so we can assume 18 means + // >= 18.20.3.) Update: Node 18.19+ had this change backported, so the + // comment from above applies to Node 18.19+ as well. const isNode20 = !!process.version.match(/^v20\./); - expect(closed).toBe(isNode18 || isNode20 ? 1 : 0); + expect(closed).toBe(isNode20 ? 1 : 0); }); // This test specifically added for Node 20 fails for Node 14. Just going