Core CLI Commands in Vitest

From the Vitest cheat sheet ยท CLI & Watch Mode ยท verified Nov 2026

Core CLI Commands

The vitest commands and flags you reach for every day

bash
vitest                      # watch mode (single run in CI)
vitest run                  # run once and exit
vitest math                 # files whose path contains "math"
vitest src/math.test.ts:12  # the test at line 12
vitest -t "adds"            # test names matching a regex
vitest -u                   # update snapshots
vitest run --coverage       # with coverage
๐Ÿ“Œ Path filters are substring matches, not globs or regex
โšก vitest related --run is ideal for lint-staged pre-commit hooks
๐Ÿ’ก vitest doctor reruns your suite with other pools and suggests a win
๐Ÿ” Flags accept camelCase or kebab-case: --passWithNoTests works
clirunwatch

Continue with Vitest

Save the full cheat sheet or work through every related task.

More Vitest tasks

Back to the full Vitest cheat sheet