Vitest Migration

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

alexngai Updated
skill-tree CLI — list, search, read, and fork versioned agent skills

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.spyOn → vi.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 commit 2479d78061

Frequently asked questions

npx get-skill add alexngai/vitest-migration