From a966abfd31c22a1f34157ffb335952e8dbbe6615 Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Thu, 25 Jul 2024 20:22:51 +0200 Subject: [PATCH] test: unflake happy-eyeballs tests (#31861) --- tests/library/browsercontext-fetch-happy-eyeballs.spec.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/library/browsercontext-fetch-happy-eyeballs.spec.ts b/tests/library/browsercontext-fetch-happy-eyeballs.spec.ts index c37859b146..e9de33bcfb 100644 --- a/tests/library/browsercontext-fetch-happy-eyeballs.spec.ts +++ b/tests/library/browsercontext-fetch-happy-eyeballs.spec.ts @@ -35,8 +35,12 @@ const __testHookLookup = (hostname: string): LookupAddress[] => { let interceptedHostnameLookup: string | undefined; -it.beforeEach(() => { +it.beforeEach(({ server }) => { interceptedHostnameLookup = undefined; + // Force a new connection every time, so that we can intercept the hostname lookup. + server.setExtraHeaders('/simple.json', { + 'Connection': 'close', + }); }); it('get should work', async ({ context, server }) => {