Why Choose Vitest, The Tools it Offers, and the Ones It Complements
Vitest is the prescribed test runner for Vite and Vite is the prescribed build tool for Vue, so the choice is a no-brainer.
In this lesson, we’ll explore all the reasons behind the choice of Vitest as the Vue testing default.
Vitest shares your Vite config, transformers, and plugins (no parallel toolchain). It’s benefits go beyond a simple setup story boasting a wealth of features including:
- unit tests - for testing small units of code (function, classes, etc)
- browser-mode component tests - for true to life component specs
- visual regression tests - to ensure pixel perfect output
- REST API checks with fetch - for backend tests that resemble the syntax of a unit test
- higher-confidence integration/E2E - when paired with Playwright for testing across the seams
- and TypeScript type assertions - for the strictest of TS reliability
You’ll also see coverage reporting and the many ways to run tests: CLI watch mode, agents, CI, browser GUI, and IDE extensions By the end of the lesson, you’ll know the toolkit before we dive into the strategy.
Links
