← All notes

Vitest is a Vite-powered test runner that watches by default

Answer: Vitest is a testing framework powered by Vite. Install Vitest with npm install -D vitest. By default, tests must contain .test. or .spec. in their file name. Add a package.json script of "test": "vitest" and run it. A bare vitest run watches for file changes; use vitest run to execute once.

Config and scripts

Vitest reads your existing vite.config. by default, so Vite plugins already in that file apply to tests. You can also add a dedicated vitest.config.. Vitest requires Vite >=v6.4.0 and Node >=v22.12.0. A typical package.json script is "test": "vitest". Tests import expect and test from vitest.

The CLI in source

createCLI calls cac('vitest'), then cli.version(version), and addCliOptions.

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources and notices: Vitest documentation and source (vitest-dev/vitest): Copyright (c) 2021-Present VoidZero Inc. and Vitest contributors; MIT (https://raw.githubusercontent.com/vitest-dev/vitest/main/LICENSE). Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Vitest docs and Vitest source (vitest-dev/vitest), MIT. Notices: Vitest documentation and source (vitest-dev/vitest): Copyright (c) 2021-Present VoidZero Inc. and Vitest contributors; MIT (https://raw.githubusercontent.com/vitest-dev/vitest/main/LICENSE).

Cite this

Permanent ID: iil:note:y3yh2s6w

iinventedlight. 2026. "Vitest is a Vite-powered test runner that watches by default." iinventedlight Library, iil:note:y3yh2s6w, version of 2026-11-11. https://iinventedlight.com/library/notes/vitest-test-runner/. License: CC-BY-4.0.

@misc{iil_note_y3yh2s6w,
  author = {{iinventedlight}},
  title = {{Vitest is a Vite-powered test runner that watches by default}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-11},
  url = {https://iinventedlight.com/library/notes/vitest-test-runner/},
  note = {Permanent ID iil:note:y3yh2s6w. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com.

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/vitest-test-runner.md.