Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/vitest-dev/vitest. Next generation testing framework powered by Vite. vitest.dev
test testing-tools vite
Something went wrong. Try again.
Markdown
Vitest Docs Guide #
Guidance for working on the VitePress site in docs/. The root AGENTS.md applies here too.
Building #
- Local dev server:
pnpm docs(from the repo root) - Build with
pnpm docs:buildfrom the repo root; it sets the required env vars and regenerates the CLI table first - The build type-checks code samples against the built workspace packages, so run
pnpm buildat the repo root first
What fails the build #
- Code blocks tagged
ts twoslashare type-checked duringpnpm docs:buildonly; the dev server skips twoslash and will not catch broken samples. A sample that intentionally fails needs// @errors: <code>; use// ---cut---and// @filename:to hide setup lines. Changing public types inpackages/can break twoslash samples. - Dead internal links fail the build. Every CLI option gets a generated link to
/config/<option>, so a new option needs a matchingdocs/config/<option>.mdpage (or an entry inskipConfigindocs/.vitepress/scripts/cli-generator.ts).
Conventions #
- New docs pages are not auto-discovered: add a sidebar entry in
docs/.vitepress/config.ts(the/config,/guide, and/apisidebars are hand-maintained arrays) - Mark the version an API appeared in with
<Version>X.Y.Z</Version>in the heading (the component renders the trailing+itself) plus an explicit{#anchor} - Experimental APIs use
<Version type="experimental">X.Y.Z</Version>with<Experimental />; deprecated APIs use<Deprecated /> - Config pages use frontmatter
title: <name> | Config,outline: deep, and a- **Type:** / - **Default:** / - **CLI:**list
Generated files (never edit by hand) #
docs/guide/cli-generated.mdis generated frompackages/vitest/src/node/cli/cli-config.ts; regenerate withpnpm -C docs run cli-tableand commit the resultdocs/.vitepress/contributor-names.jsonis generated bypnpm docs:contributors