From 80d452c12bece10159d768e6e02811cff0118d7d Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sun, 1 Mar 2026 01:07:09 +0100 Subject: [PATCH] fix(tests): cleanup ALL private intervals in cleanupChargingStation Adds cleanup for: - wsPingSetInterval (private) - WebSocket ping timer - flushMessageBufferSetInterval (private) - message buffer flush timer - transactionTxUpdatedSetInterval - OCPP 2.0 transaction update timer These uncleaned intervals were keeping the Node.js event loop alive, causing Windows CI tests to hang indefinitely. --- .../helpers/StationHelpers.ts | 31 +++++++++++++++---- 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/tests/charging-station/helpers/StationHelpers.ts b/tests/charging-station/helpers/StationHelpers.ts index d88939cb..230fd8dc 100644 --- a/tests/charging-station/helpers/StationHelpers.ts +++ b/tests/charging-station/helpers/StationHelpers.ts @@ -175,12 +175,23 @@ export function cleanupChargingStation (station: ChargingStation): void { station.heartbeatSetInterval = undefined } - // Stop WebSocket ping timer - if (station.wsPingSetInterval != null) { - clearInterval(station.wsPingSetInterval) - station.wsPingSetInterval = undefined + // Stop WebSocket ping timer (private, accessed for cleanup) + /* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access, + @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-argument */ + const stationInternal = station as any + if (stationInternal.wsPingSetInterval != null) { + clearInterval(stationInternal.wsPingSetInterval) + stationInternal.wsPingSetInterval = undefined } + // Stop message buffer flush timer (private, accessed for cleanup) + if (stationInternal.flushMessageBufferSetInterval != null) { + clearInterval(stationInternal.flushMessageBufferSetInterval) + stationInternal.flushMessageBufferSetInterval = undefined + } + /* eslint-enable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access, + @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-argument */ + // Close WebSocket connection if (station.wsConnection != null) { try { @@ -197,21 +208,29 @@ export function cleanupChargingStation (station: ChargingStation): void { // Ignore errors during cleanup } - // Clear connector transaction state + // Clear connector transaction state and timers for (const connectorStatus of station.connectors.values()) { if (connectorStatus.transactionSetInterval != null) { clearInterval(connectorStatus.transactionSetInterval) connectorStatus.transactionSetInterval = undefined } + if (connectorStatus.transactionTxUpdatedSetInterval != null) { + clearInterval(connectorStatus.transactionTxUpdatedSetInterval) + delete connectorStatus.transactionTxUpdatedSetInterval + } } - // Clear EVSE connector transaction state + // Clear EVSE connector transaction state and timers for (const evseStatus of station.evses.values()) { for (const connectorStatus of evseStatus.connectors.values()) { if (connectorStatus.transactionSetInterval != null) { clearInterval(connectorStatus.transactionSetInterval) connectorStatus.transactionSetInterval = undefined } + if (connectorStatus.transactionTxUpdatedSetInterval != null) { + clearInterval(connectorStatus.transactionTxUpdatedSetInterval) + delete connectorStatus.transactionTxUpdatedSetInterval + } } } -- 2.53.0