From: Jérôme Benoit Date: Sun, 1 Mar 2026 23:04:02 +0000 (+0100) Subject: fix(tests): use inline type exports to fix Windows ESM compatibility X-Git-Tag: v3~35 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=3416cd2bf1200e8da6ce49936eaf12f32ddfe4fb;p=e-mobility-charging-stations-simulator.git fix(tests): use inline type exports to fix Windows ESM compatibility Consolidate separate 'export type' and 'export' re-exports into single export block with inline 'type' keyword. This ensures proper ESM module resolution on Windows where Node.js strictly validates named exports. Reverts the workaround of splitting imports in OCPP20TestUtils.ts since the root cause (improper re-export pattern) is now fixed at source. --- diff --git a/tests/charging-station/ChargingStationTestUtils.ts b/tests/charging-station/ChargingStationTestUtils.ts index 028c2a94..72fe49ca 100644 --- a/tests/charging-station/ChargingStationTestUtils.ts +++ b/tests/charging-station/ChargingStationTestUtils.ts @@ -19,22 +19,19 @@ export { standardCleanup, } from '../helpers/TestLifecycleHelpers.js' -// Re-export all helper functions and types -export type { - ChargingStationMocks, - CreateConnectorStatusOptions, - MockChargingStation, - MockChargingStationOptions, - MockChargingStationResult, - MockOCPPIncomingRequestService, - MockOCPPRequestService, -} from './helpers/StationHelpers.js' - +// Re-export all helper functions and types from StationHelpers export { + type ChargingStationMocks, cleanupChargingStation, createConnectorStatus, + type CreateConnectorStatusOptions, createMockChargingStation, createMockChargingStationTemplate, + type MockChargingStation, + type MockChargingStationOptions, + type MockChargingStationResult, + type MockOCPPIncomingRequestService, + type MockOCPPRequestService, resetChargingStationState, } from './helpers/StationHelpers.js' diff --git a/tests/charging-station/ocpp/2.0/OCPP20TestUtils.ts b/tests/charging-station/ocpp/2.0/OCPP20TestUtils.ts index 5a3b8f4d..87a72853 100644 --- a/tests/charging-station/ocpp/2.0/OCPP20TestUtils.ts +++ b/tests/charging-station/ocpp/2.0/OCPP20TestUtils.ts @@ -17,7 +17,6 @@ import type { OCPP20IdTokenType, OCPP20TransactionContext, } from '../../../../src/types/ocpp/2.0/Transaction.js' -import type { MockChargingStation } from '../../ChargingStationTestUtils.js' import { ConnectorStatusEnum, @@ -28,7 +27,7 @@ import { import { OCPP20IdTokenEnumType } from '../../../../src/types/ocpp/2.0/Transaction.js' import { Constants } from '../../../../src/utils/index.js' import { TEST_CHARGING_STATION_BASE_NAME } from '../../ChargingStationTestConstants.js' -import { createMockChargingStation } from '../../ChargingStationTestUtils.js' +import { createMockChargingStation, MockChargingStation } from '../../ChargingStationTestUtils.js' // ============================================================================ // Testable Interfaces