π OpenHands: AI-Driven Development
fix(frontend): skip flaky WebSocket broadcast tests (#11972)
sp.wacke18168020a3c
diff --git a/frontend/__tests__/hooks/use-websocket.test.ts b/frontend/__tests__/hooks/use-websocket.test.tsindex 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