From e18168020a3c4b43a2fe8f6f25695c3e1a59313f Mon Sep 17 00:00:00 2001 From: "sp.wack" <83104063+amanape@users.noreply.github.com> Date: Tue, 9 Dec 2025 18:57:26 +0400 Subject: [PATCH] fix(frontend): skip flaky WebSocket broadcast tests (#11972) --- frontend/__tests__/hooks/use-websocket.test.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/frontend/__tests__/hooks/use-websocket.test.ts b/frontend/__tests__/hooks/use-websocket.test.ts index cb76fbcc90..50e8e70571 100644 --- a/frontend/__tests__/hooks/use-websocket.test.ts +++ b/frontend/__tests__/hooks/use-websocket.test.ts @@ -1,3 +1,11 @@ +/** + * TODO: Fix flaky WebSocket tests (https://github.com/OpenHands/OpenHands/issues/11944) + * + * Several tests in this file are skipped because they fail intermittently in CI + * but pass locally. The SUSPECTED root cause is that `wsLink.broadcast()` sends messages + * to ALL connected clients across all tests, causing cross-test contamination + * when tests run in parallel with Vitest v4. + */ import { renderHook, waitFor } from "@testing-library/react"; import { describe, @@ -51,7 +59,7 @@ describe("useWebSocket", () => { expect(result.current.socket).toBeTruthy(); }); - it("should handle incoming messages correctly", async () => { + it.skip("should handle incoming messages correctly", async () => { const { result } = renderHook(() => useWebSocket("ws://acme.com/ws")); // Wait for connection to be established @@ -114,7 +122,7 @@ describe("useWebSocket", () => { expect(result.current.socket).toBeTruthy(); }); - it("should close the WebSocket connection on unmount", async () => { + it.skip("should close the WebSocket connection on unmount", async () => { const { result, unmount } = renderHook(() => useWebSocket("ws://acme.com/ws"), ); @@ -204,7 +212,7 @@ describe("useWebSocket", () => { }); }); - it("should call onMessage handler when WebSocket receives a message", async () => { + it.skip("should call onMessage handler when WebSocket receives a message", async () => { const onMessageSpy = vi.fn(); const options = { onMessage: onMessageSpy }; @@ -271,7 +279,7 @@ describe("useWebSocket", () => { expect(onErrorSpy).toHaveBeenCalled(); }); - it("should provide sendMessage function to send messages to WebSocket", async () => { + it.skip("should provide sendMessage function to send messages to WebSocket", async () => { const { result } = renderHook(() => useWebSocket("ws://acme.com/ws")); // Wait for connection to be established