0Pricing
Sveltejs Academy · Lesson

Vitest Setup for Svelte Projects

Configure Vitest with the Svelte plugin and jsdom environment for component testing.

Vitest

Vitest is a fast, Vite-native test runner widely used in the Svelte ecosystem.

Install

Add Vitest and the Svelte plugin.

npm install -D vitest @vitest/coverage-v8 @testing-library/svelte @testing-library/jest-dom jsdom

All lessons in this course

  1. Vitest Setup for Svelte Projects
  2. @testing-library/svelte: render and fireEvent
  3. Testing Stores and Reactivity
  4. Mocking Modules and Fetch
← Back to Sveltejs Academy