Skip to content

Commit ebf9954

Browse files
committed
frontend: multiplexer: cancel pending timers in test teardown
The afterEach in multiplexer.test.ts called pendingUnsubscribes.clear() without cancelling the stored timeouts. This left orphaned setTimeout callbacks that could fire after vitest tore down the jsdom environment, causing a sporadic "ReferenceError: WebSocket is not defined". Call forEach(clearTimeout) before clear() so all pending debounce timers are cancelled before the test environment is destroyed.
1 parent 6684be3 commit ebf9954

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

frontend/src/lib/k8s/api/v2/multiplexer.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ describe('WebSocket Multiplexer', () => {
8989
WebSocketManager.listeners.clear();
9090
WebSocketManager.completedPaths.clear();
9191
WebSocketManager.activeSubscriptions.clear();
92+
WebSocketManager.pendingUnsubscribes.forEach(clearTimeout);
9293
WebSocketManager.pendingUnsubscribes.clear();
9394
});
9495

0 commit comments

Comments
 (0)