vitest.config.ts in Vitest
From the Vitest cheat sheet ยท Setup & Configuration ยท verified Nov 2026
vitest.config.ts
Configure Vitest with defineConfig, reuse your Vite config, and extend the defaults
typescript
import { defineConfig } from 'vitest/config'
export default defineConfig({
test: {
environment: 'node',
include: ['src/**/*.test.ts'],
setupFiles: ['./vitest.setup.ts'],
testTimeout: 5_000,
},
})๐ A vitest.config.ts overrides vite.config.ts; merge them to keep plugins
โ ๏ธ Setting include or exclude replaces the defaults; spread configDefaults
๐ก Vite options like plugins and resolve.alias go at the top level
๐ process.env.VITEST is set, so vite.config can branch for tests
configdefineConfig
Continue with Vitest
Save the full cheat sheet or work through every related task.