Commit Graph

2 Commits

Author SHA1 Message Date
Kazuki Yamada
3811fdb8eb test(coverage): Address PR review feedback for test quality improvements
Implemented mandatory and recommended fixes from code review:

1. Fix timer cleanup in cliSpinner.test.ts
   - Added vi.useRealTimers() to afterEach hook
   - Prevents fake timers from bleeding into other test files

2. Fix isCancel mock in initAction.test.ts (3 locations)
   - Changed from mockReturnValue(true) to mockImplementation
   - Now properly tests only the actual cancel symbol
   - More accurate test behavior for cancellation scenarios

3. Add DI pattern explanation comment in configLoad.ts
   - Clarifies why dependency injection is used for jitiImport
   - Documents the double instrumentation issue
   - Helps future maintainers understand the design decision
2025-10-31 01:18:21 +09:00
Kazuki Yamada
72735cfdb1 test(coverage): Improve test coverage for CLI and core modules
Added comprehensive test coverage for critical CLI and core functionality:

- Created new test file for cliSpinner with 15 tests covering:
  * Spinner start/stop/update operations
  * Quiet/verbose/stdout mode handling
  * Success/fail message display
  * Interval management

- Enhanced initAction tests (11→17 tests):
  * Added isCancel handling for user cancellation
  * Added return value validation tests
  * Covered config and ignore file creation flows

- Enhanced cliReport tests (8→15 tests):
  * Added git diffs/logs reporting tests
  * Added security check reporting for git content
  * Added single vs multiple issue message handling

- Enhanced permissionCheck tests (13→16 tests):
  * Added macOS-specific error message tests
  * Added platform-specific error handling tests
  * Added unknown error code handling

- Enhanced outputGenerate tests (7→12 tests):
  * Added git diffs/logs inclusion tests
  * Added JSON format output tests
  * Added file/directory structure exclusion tests

Overall improvements:
- Test count: 804 → 840 (+36 tests)
- Code coverage: 70.63% → 71.00% (+0.37%)
- Branch coverage: 77.64% → 78.55% (+0.91%)
- Significant improvement in CLI modules (cliSpinner: 25% → 59.61%)
2025-10-31 01:18:21 +09:00