Jest
Discouraged
Not our default choice. We recommend Vitest for most projects.
What is itโ
Jest is a JavaScript testing framework developed by Meta. It provides a batteries-included experience with built-in assertions, mocking, code coverage, and snapshot testing. With ~45M weekly npm downloads, it has a mature ecosystem and extensive community support.
Why it's not our defaultโ
- Slower than Vitest for Vite projects โ Jest requires separate Babel/ts-jest transforms; Vitest reuses Vite's pipeline for near-instant feedback.
- Duplicate configuration โ Jest needs its own transform, module resolution, and alias setup that duplicate what's already in
vite.config.ts. - No native ESM support โ Jest's ESM support is still experimental; Vitest handles ESM natively through Vite.
- Heavier setup for TypeScript โ requires
ts-jestor Babel presets, whereas Vitest understands TypeScript out of the box.
When it makes senseโ
- Non-Vite projects with deep webpack integration โ where switching to Vitest would require significant build-tool changes.
- Existing large Jest test suites โ when migration cost outweighs the benefits, maintain consistency.
- Projects requiring specific Jest ecosystem plugins โ some niche plugins haven't been ported to Vitest yet.