Skip to content

chore: migrate to vitest with 95% coverage gate#2

Open
nocoo wants to merge 2 commits intomainfrom
fix/vitest-migration
Open

chore: migrate to vitest with 95% coverage gate#2
nocoo wants to merge 2 commits intomainfrom
fix/vitest-migration

Conversation

@nocoo
Copy link
Copy Markdown
Owner

@nocoo nocoo commented May 1, 2026

Migrate test framework to vitest with 95% coverage thresholds on all four dimensions (statements, branches, functions, lines).

nocoo added 2 commits May 1, 2026 12:17
- Replace jest with vitest 4.1.5 + @vitest/coverage-v8
- Add vitest.config.ts with v8 coverage provider and 95% thresholds
- Update package.json scripts: test, test:coverage
- Migrate jest.fn/mock/spyOn to vi equivalents in test files
- Refactor lib/ipsafe.js to use childProcess namespace (vi.spyOn-friendly)
- Update eslint config to expose vi global in tests
Final coverage: stmts 99.61%, branches 98.11%, funcs 100%, lines 99.59%.

- Add platform-specific config path tests (Windows AppData, XDG_CONFIG_HOME).
- Add edge case tests for loadConfig, initGlobalConfig, testConnectivity
  defaults (port, method, headers), executeCommand signal/timeout cleanup,
  parseCommand quote handling, checkContent uppercase regex.
- Cover all interactive command names (claude, vim, nano, less, more,
  top, htop) and uppercase variants.
- Use cache-busted dynamic import() in cli.test.js so the bin script
  re-executes per test (vitest 4 removed vi.isolateModulesAsync).
- Annotate implicit-else branches with /* v8 ignore else */ since
  vitest 4's V8 coverage cannot track synthetic else branches for
  if-without-else statements (reports [hits, 0] with empty location).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant