From 5c0636888c7b8686fca671a48718c7cf11ef252f Mon Sep 17 00:00:00 2001 From: Yoshiya Hinosawa Date: Wed, 8 Dec 2021 02:50:35 +0900 Subject: [PATCH] fix(ext/timers): fix flakiness of `httpConnAutoCloseDelayedOnUpgrade` test (#13017) --- cli/tests/unit/http_test.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cli/tests/unit/http_test.ts b/cli/tests/unit/http_test.ts index 7cf62c0466..a52ea3cc71 100644 --- a/cli/tests/unit/http_test.ts +++ b/cli/tests/unit/http_test.ts @@ -1055,12 +1055,16 @@ Deno.test( const { socket, response } = Deno.upgradeWebSocket(event1.request); socket.onmessage = (event) => socket.send(event.data); + const socketClosed = new Promise((resolve) => { + socket.onclose = () => resolve(); + }); event1.respondWith(response); const event2 = await event2Promise; assertStrictEquals(event2, null); listener.close(); + await socketClosed; } async function client() {