$ recombobulate _
home / tips / convert-your-jest-test-suite-to-vitest-with-claude
0

Convert Your Jest Test Suite to Vitest with Claude

bagwaa @bagwaa · Mar 26, 2026 · Workflows
convert-your-jest-test-suite-to-vitest-with-claude

Vitest is faster than Jest and shares almost identical API surface — but migrating a large test suite is still a surprisingly fiddly job. Claude can handle the mechanical parts in bulk.

Start by giving Claude your package.json and asking it to plan the migration:

I want to migrate from Jest to Vitest. Here's my package.json.
List the exact npm commands to run, the config changes needed, and any 
Jest-specific patterns in my tests that won't work with Vitest out of the box.

Then migrate the tests themselves:

Convert @tests/unit/UserService.test.ts from Jest to Vitest.
Replace all jest.fn() with vi.fn(), jest.mock() with vi.mock(), 
jest.spyOn() with vi.spyOn(), and update any jest.useFakeTimers() calls.
Keep the describe/it/expect structure identical.

Claude will also update your tsconfig.json to include Vitest types, strip the @types/jest dependency, and rewrite your vitest.config.ts with coverage settings matching your old Jest config.

For projects using jest.config.js transform pipelines or custom resolvers, paste the config directly and ask Claude to map the equivalent Vitest options — they're similar but not identical.

Switching to Vitest is one of those migrations that looks simple until it isn't — let Claude do the tedious diffing so you can spend the time on actual code.

~/recombobulate $ tip --comments --count=0

Log in to leave a comment.

~/recombobulate $ tip --related --limit=3
0
Scan Pending Changes for Security Issues with /security-review

The /security-review command scans your uncommitted changes for injection vectors, auth gaps, hardcoded secrets, and other common vulnerabilities.

bagwaa @bagwaa · 2 hours ago
0
Run Setup Scripts on Every Session with the SessionStart Hook

The SessionStart hook fires when any session begins or resumes, making it ideal for loading environment variables and running one-time setup scripts.

bagwaa @bagwaa · 2 hours ago
0
Write Property-Based Tests with fast-check and Claude

Ask Claude to write property-based tests for your functions using fast-check — it identifies the mathematical invariants in your code and generates tests that cover inputs you'd never enumerate by hand.

bagwaa @bagwaa · 2 hours ago