Vitest Migration

Migrate a Jest test suite to Vitest — config, globals, and mock API differences.

alexngai Updated

File contents

Migrate Jest → Vitest

  1. Add vitest and create vitest.config.ts (reuse your Vite config if you have one).
  2. Enable globals: true to keep describe/it/expect without imports.
  3. Swap jest.fn()vi.fn(), jest.mock()vi.mock(), jest.spyOnvi.spyOn.
  4. Replace jest.config timers/fake-timers with vi.useFakeTimers().
  5. Run vitest run in CI; drop ts-jest once green.

alexngai/skill-tree/tree/main/docs/demo/skills/vitest-migration commit 2479d78061

Frequently asked questions

npx skillmds@latest add alexngai/vitest-migration