vitest-best-practices
Installation
SKILL.md
Vitest best practices
Use when writing, reviewing, or debugging tests with Vitest.
Mental model
- Vitest is a Vite-powered test runner. Its configuration and module behavior are closely tied to Vite’s transform pipeline.
- Keep tests aligned with the runtime they simulate: node, jsdom, happy-dom, or browser mode.
- Treat test setup as part of the architecture surface, not as disposable glue code.
Config and structure
- Prefer a single clear config path. If the project already has
vite.config.*, keep Vitest config integrated there unless the repo has a documented reason to split it out. - If a separate
vitest.config.*exists, make sure it intentionally mirrors or merges the Vite settings the tests depend on. - Keep setup files, aliases, and environment assumptions explicit so failures are reproducible.