* fix(test): add --test-force-exit to prevent Windows CI hang
Windows CI was hanging after test completion due to Node.js's handling of
stdout/stderr on Windows. On Windows, stdio uses Named Pipes (Sockets) that
remain 'ref'd' and keep the event loop alive, unlike Unix where file
descriptors are auto-unref'd.
The --test-force-exit flag is the official Node.js solution for this
Windows-specific behavior (see Node.js issue #49925).
Also fixes:
- createMockAuthorizationResult signature to accept only overrides parameter
- Remove setImmediate from mock.timers in Reset test (not needed)
* fix(test): wrap multiple describe blocks in parent for --test-force-exit compatibility
Node.js test runner with --test-force-exit has issues with multiple top-level
await describe() blocks. Wrapping both 'Error Recovery and Resilience' and
'Message Buffering' describe blocks in a parent 'ChargingStation Resilience'
describe block fixes the 'Promise resolution is still pending' errors.
* fix(test): wrap OCPP20 test describe blocks for --test-force-exit compatibility
Same fix as ChargingStation-Resilience.test.ts - wrapping multiple top-level
await describe() blocks in a parent describe block to fix Windows CI hang.
* fix(tests): add missing deleteIdTags method to MockIdTagsCache
The MockIdTagsCache mock was missing the deleteIdTags() method that exists
on the real IdTagsCache class. This caused ClearCache tests to fail when
the method was called during test execution.
* fix(tests): improve test isolation for OCPP 2.0 tests
- Add ocppConfiguration with configurationKey to GetBaseReport test setup
so ConfigurationInventory reports have data to return
- Add ocppConfiguration with HeartbeatInterval and WebSocketPingInterval
to VariableManager test setup for proper isolation
- Fix MessageTimeout test expectations to use seconds (OCPP 2.0 unit)
instead of milliseconds (station.getConnectionTimeout())
These changes ensure tests pass when run individually or in any order,
which is required for --test-force-exit on Windows.
* refactor(tests): use constants instead of hardcoded values in GetBaseReport test
Replace hardcoded '60' and '30' values with proper constant references:
- HeartbeatInterval: millisecondsToSeconds(Constants.DEFAULT_HEARTBEAT_INTERVAL)
- MeterValueSampleInterval: millisecondsToSeconds(Constants.DEFAULT_METER_VALUES_INTERVAL)
This follows the single source of truth principle from TEST_STYLE_GUIDE.md
and maintains consistency with OCPP20VariableManager.test.ts.
* docs(tests): document Windows CI constraints and --test-force-exit
Add section 5 'Platform-Specific Considerations' to TEST_STYLE_GUIDE.md:
- Explain why --test-force-exit is needed (Windows Named Pipes behavior)
- Document single top-level describe block requirement
- Update section numbers and summary accordingly
This documents the root cause and solution for the Windows CI hang issue.