Files
Kazuki Yamada 247221b472 fix(test): Stabilize test coverage by preventing jiti double instrumentation
This commit resolves test coverage instability that occurred after
implementing JS/TS config support. Coverage was fluctuating between
68-71% on each test run, caused by jiti dynamically transforming src/
files that were already instrumented by Vitest for coverage tracking.

Root Cause:
- Test fixture files imported `defineConfig` from src/index.js
- jiti transformed the entire src/ directory when loading fixtures
- Same files existed in two versions (Vitest-instrumented vs jiti-transformed)
- v8 coverage tracker produced non-deterministic results

Solution:
1. Added DI pattern to loadFileConfig with defaultJitiImport factory
2. Removed defineConfig imports from all test fixtures (use plain objects)
3. Mock jiti in dynamic config tests to prevent src/ transformation

Results:
- Coverage now stable at 89.34% (previously 68-71%)
- Coverage improved by ~19% due to accurate instrumentation
- Integration test runtime improved from 3.8s to 0.1s
- All tests pass with zero lint errors

Related Changes:
- Reverted temporary Vitest config workarounds (sequence.shuffle, isolate)
- Extracted defaultJitiImport as reusable factory function
2025-10-31 01:18:21 +09:00
..