Migration Gotchas in Vitest
From the Vitest cheat sheet · Migrating from Jest · verified Nov 2026
Migration Gotchas
Config and behavior differences to check when moving a Jest suite to Vitest
typescript
// vitest.config.ts settings that ease a Jest migration
export default defineConfig({
test: {
globals: true, // describe/test/expect without imports
environment: 'jsdom', // if your Jest config used jsdom
sequence: { hooks: 'list' }, // run hooks in Jest's order
setupFiles: ['./jest.setup.ts'], // reuse your setup file
},
})⚠️ Jest runs hooks in order; Vitest stacks them unless hooks: list
📌 vi.mock factories must return named keys, including default
🔍 Expect some snapshot churn; rerun with -u and review the diff
💡 Migrate file by file; Jest and Vitest can coexist during the move
jestmigrationgotchas
Continue with Vitest
Save the full cheat sheet or work through every related task.