From: Jérôme Benoit Date: Sat, 28 Feb 2026 23:59:52 +0000 (+0100) Subject: fix(tests): restore ping() method and cleanup wsPingSetInterval X-Git-Tag: ocpp-server@v3.0.0~53 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=df60b612e9fb861597445d13886b88bac674b966;p=e-mobility-charging-stations-simulator.git fix(tests): restore ping() method and cleanup wsPingSetInterval Fixes Windows CI hang caused by: - Missing wsPingSetInterval cleanup in cleanupChargingStation() - Removed ping()/pong() methods that ChargingStation.ts still calls The WebSocket ping interval was never cleared during test cleanup, keeping the Node.js event loop alive indefinitely on Windows. --- diff --git a/tests/charging-station/helpers/StationHelpers.ts b/tests/charging-station/helpers/StationHelpers.ts index d3b6de4c..d88939cb 100644 --- a/tests/charging-station/helpers/StationHelpers.ts +++ b/tests/charging-station/helpers/StationHelpers.ts @@ -175,6 +175,12 @@ export function cleanupChargingStation (station: ChargingStation): void { station.heartbeatSetInterval = undefined } + // Stop WebSocket ping timer + if (station.wsPingSetInterval != null) { + clearInterval(station.wsPingSetInterval) + station.wsPingSetInterval = undefined + } + // Close WebSocket connection if (station.wsConnection != null) { try { diff --git a/tests/charging-station/mocks/MockWebSocket.ts b/tests/charging-station/mocks/MockWebSocket.ts index 2420023b..04e75bc7 100644 --- a/tests/charging-station/mocks/MockWebSocket.ts +++ b/tests/charging-station/mocks/MockWebSocket.ts @@ -98,6 +98,20 @@ export class MockWebSocket extends EventEmitter { return this.sentMessages.map(msg => JSON.parse(msg) as unknown) } + /** + * Ping the server (no-op in mock) + */ + public ping (): void { + // No-op for tests + } + + /** + * Pong response (no-op in mock) + */ + public pong (): void { + // No-op for tests + } + /** * Send a message through the WebSocket * @param data - Message to send