0Pricing
Vue Academy · Lesson

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-v8

All lessons in this course

  1. Vitest Setup for Vue Projects
  2. Mounting and Querying Components
  3. Testing User Interactions and Events
  4. Mocking Composables, Stores, and APIs
← Back to Vue Academy