Vitest
$ vitest Community Low RiskFast unit and component test framework sharing Vite's configuration and transform pipeline. Coding agents must pass vitest run (to avoid interactive watch mode) and can capture clean machine-readable results via --reporter=json.
npm install -D vitest Executes local Vite-transformed unit tests directly inside the repository.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
Native --reporter=json, vitest list --json, --run, and NO_COLOR=1, though bare vitest defaults to interactive watch mode outside CI.
vitest run --reporter=jsonoutputs structured test JSON- Bare
vitestenters watch mode unlessrunorCI=trueis set
Local test runner; never updates snapshots unless -u (--update) is explicitly passed.
- Snapshots are verified read-only unless
-uis passed
Standard npm devDependency running across macOS, Linux, and Windows with Node.js.
- Cross-platform Node.js CLI
Fast TypeScript/ESM execution with Vite transforms and granular file/test-name filtering (-t).
- Instant HMR-style module graph and
-ttest filtering
Actively maintained MIT project led by the VoidZero / Vite ecosystem team.
- Active
vitest-dev/vitestrepository
Clear CLI guide at vitest.dev/guide/cli and comprehensive flag help.
- Official CLI reference at vitest.dev/guide/cli
Security, Auth & Guardrails
No credentials stored or required; runs locally against workspace test files.
MIT open-source npm package; completely free.
# Vitest (vitest) Agent Rules - ALWAYS pass `vitest run` (never bare `vitest`) so the runner exits instead of hanging in watch mode. - Use `--reporter=json` (or `--reporter=dot`) and `NO_COLOR=1` for concise output.
Agent-Ready Command Recipes
Safe Read-Only Queries
npx vitest list --json
Enumerates discovered test files and names in JSON without executing test suites.
Controlled Writes & Previews
NO_COLOR=1 npx vitest run --reporter=json
Runs all tests once (avoiding watch mode) and outputs structured JSON test results.
Strengths for Agents
- +
vitest run --reporter=jsonandvitest list --jsongive agents exact JSON test results. - + Reuses
vite.config.*transforms with zero extra Babel/ts-jest boilerplate. - + Fast worker pool and
-t/ filename filtering.
Caveats & Pitfalls
- ! Running
vitestwithoutrun(orCI=true) launches an interactive watch loop that hangs non-TTY agents. - ! Does not run
tsctype-checking during normalvitest rununless--typecheckis configured.