vitest-testing
Vitest Testing
This skill equips you to configure, run, debug, and review a Vitest suite: the runner's own surface — its config file, its vi API, its pools and reporters, its coverage providers, and its Browser Mode — plus the operational rules an agent needs to drive it without hanging a session or burning a context window.
It is the runner-specific layer. A tool-agnostic unit-testing capability owns what to assert, how to name a spec, what makes a fixture good, and whether a behavior deserves a unit test at all; those questions have the same answers whatever runner executes them. This skill owns the mechanism underneath: which option, which file, which vi call, which flag. Where a rule here touches judgment — which dependency is worth mocking, how much of a payload to pin, whether a snapshot earns its place — it points at the tool-agnostic owner rather than answering it.
Two neighbours are disclaimed explicitly. An end-to-end capability owns user journeys, the locator fallback hierarchy, server lifecycle, and scenario coverage even when the runner underneath is Vitest; this skill owns the runner configuration that suite runs on. A component-development capability owns test-hook conventions such as data-testid and testID; this skill owns the Browser Mode machinery that queries them. A project on a different runner should reach for that runner's own capability, not this one.
Version posture is lookup-first. Rules are verified against Vitest 4.1.10 (Node >= 20, Vite >= 6) and name the release they were checked against. Vitest 4 moved or removed roughly two dozen configuration options and silently ignores the old names rather than erroring, so a v3-era answer copied off the open web fails invisibly — the suite runs, the option does nothing. Wherever a surface is known to have moved, consult the installed version's own documentation at https://vitest.dev rather than recalling an option name; each reference below names the upstream page it was verified against.
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.
Running Vitest as an Agent
See running-as-an-agent.md for: