Instead of Jest: Vitest
Use Vitest. It keeps Jest's describe, it, expect and mocking API, so most suites move over with small edits, and it runs TypeScript and ES modules natively through Vite instead of through a separate transform pipeline. Jest still treats ES modules as experimental.
Both are for running unit and component tests for JavaScript and TypeScript code.
Why Vitest is better
- ES modules and TypeScript work without setup. Jest's own docs call its ESM support experimental and require running Node with --experimental-vm-modules.
- If your app builds with Vite, tests reuse the same vite.config, plugins and aliases, so there is one pipeline to configure instead of two.
- Watch mode is on by default and reruns only the tests affected by a change, using Vite's module graph. Tests run in parallel in worker threads.
- Browser Mode runs component tests in a real browser through Playwright or WebdriverIO, where Jest only offers simulated environments such as jsdom.
- Momentum has shifted. The State of JS 2025 survey reports Vitest climbing fast while Jest's satisfaction trends down.
When to keep Jest
Keep Jest for a large, stable suite that leans on Jest-specific behavior, such as automatic __mocks__ folders, legacy fake timers or done callbacks, and does not need ES modules. Jest is maintained and widely documented; in the State of JS 2024 survey 7,262 respondents used it at work against 3,986 for Vitest.
Switching
Mostly mechanical. Install vitest, either turn on the globals option or import describe, it and expect from vitest, and replace jest.fn, jest.mock and jest.requireActual with vi.fn, vi.mock and vi.importActual. Module mock factories must return an object with each export named, done callbacks become promises, and jest.Mock types are imported from vitest.
Watch out
A few behaviors differ quietly. Vitest's mockReset restores the original implementation where Jest's returns undefined, root __mocks__ folders only load when vi.mock is called, and hooks run as a stack unless you set sequence.hooks to list. Vitest 5 requires Node.js 22.12 or later and Vite 6.4 or later.
Sources
- Vitest: Why Vitest
- Vitest: Comparisons with other test runners
- Vitest: Migrating from Jest
- Vitest: Migration guide (Vitest 5)
- Vitest: Browser Mode
- Jest: ECMAScript Modules
- State of JavaScript 2025: Testing
- State of JavaScript 2024: Testing
Judged on 2026-11-06. See every test frameworks and runners, or all 66 replacements.