From 25f7bfb9ba4a05a11df965d263d8ca0953e91462 Mon Sep 17 00:00:00 2001 From: Raz Luvaton <16746759+rluvaton@users.noreply.github.com> Date: Fri, 5 Apr 2024 15:13:31 +0300 Subject: [PATCH 1/3] test(@astrojs/node) wait for server listening in trailing-slash tests --- packages/integrations/node/test/trailing-slash.test.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/integrations/node/test/trailing-slash.test.js b/packages/integrations/node/test/trailing-slash.test.js index 79d5d247a08e..e7b46877d6d9 100644 --- a/packages/integrations/node/test/trailing-slash.test.js +++ b/packages/integrations/node/test/trailing-slash.test.js @@ -36,6 +36,7 @@ describe('Trailing slash', () => { const { startServer } = await load(); let res = startServer(); server = res.server; + await waitServerListen(server.server); }); after(async () => { @@ -101,6 +102,7 @@ describe('Trailing slash', () => { const { startServer } = await load(); let res = startServer(); server = res.server; + await waitServerListen(server.server); }); after(async () => { @@ -169,6 +171,7 @@ describe('Trailing slash', () => { const { startServer } = await load(); let res = startServer(); server = res.server; + await waitServerListen(server.server); }); after(async () => { @@ -227,6 +230,7 @@ describe('Trailing slash', () => { const { startServer } = await load(); let res = startServer(); server = res.server; + await waitServerListen(server.server); }); after(async () => { @@ -288,6 +292,7 @@ describe('Trailing slash', () => { const { startServer } = await load(); let res = startServer(); server = res.server; + await waitServerListen(server.server); }); after(async () => { @@ -364,6 +369,7 @@ describe('Trailing slash', () => { const { startServer } = await load(); let res = startServer(); server = res.server; + await waitServerListen(server.server); }); after(async () => { From 45e68edf7ae4e53a5aa06a254c64729f72798696 Mon Sep 17 00:00:00 2001 From: Raz Luvaton <16746759+rluvaton@users.noreply.github.com> Date: Fri, 5 Apr 2024 15:19:43 +0300 Subject: [PATCH 2/3] fix missing waitServerListen --- packages/integrations/node/test/prerender.test.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/integrations/node/test/prerender.test.js b/packages/integrations/node/test/prerender.test.js index bf34fc99ddfd..29080981aba8 100644 --- a/packages/integrations/node/test/prerender.test.js +++ b/packages/integrations/node/test/prerender.test.js @@ -329,6 +329,7 @@ describe('Hybrid rendering', () => { const { startServer } = await load(); let res = startServer(); server = res.server; + await waitServerListen(server.server); }); after(async () => { From 82d047f7dd7ccd7133b54156121b84be299d05d9 Mon Sep 17 00:00:00 2001 From: Emanuele Stoppa Date: Fri, 5 Apr 2024 13:29:11 +0100 Subject: [PATCH 3/3] fix import statement --- packages/integrations/node/test/trailing-slash.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/integrations/node/test/trailing-slash.test.js b/packages/integrations/node/test/trailing-slash.test.js index e7b46877d6d9..ad91a275949e 100644 --- a/packages/integrations/node/test/trailing-slash.test.js +++ b/packages/integrations/node/test/trailing-slash.test.js @@ -2,7 +2,7 @@ import * as assert from 'node:assert/strict'; import { after, before, describe, it } from 'node:test'; import * as cheerio from 'cheerio'; import nodejs from '../dist/index.js'; -import { loadFixture } from './test-utils.js'; +import { loadFixture, waitServerListen } from './test-utils.js'; /** * @typedef {import('../../../astro/test/test-utils').Fixture} Fixture