Vitest Setup for Vue Projects
vitest.config.ts, jsdom environment, @vue/test-utils, coverage with v8, test script.
Why Vitest for Vue?
Vitest is a fast test runner built on Vite. Because Vue 3 projects already use Vite, Vitest reuses the same config and transforms — no separate build pipeline for tests.
It gives you a Jest-like API with native ESM and TypeScript support.
Installing the Tooling
Add Vitest, the Vue testing utilities, and jsdom (a browser-like DOM for Node).
// terminal
// npm install -D vitest @vue/test-utils jsdom @vitest/coverage-v8All lessons in this course
- Vitest Setup for Vue Projects
- Mounting and Querying Components
- Testing User Interactions and Events
- Mocking Composables, Stores, and APIs