Koskamo

Watch mode and test filtering

Document v1 · published by Koskamo editorial · updated 2026-10-04

Original source

vitest starts in watch mode by default in development and in run mode in CI (when process.env.CI is present); vitest watch and vitest run select the mode explicitly. In watch mode, Vitest searches the module graph and only reruns tests related to changed files. To narrow a run, pass a filename substring to run only matching test files, or use -t (or --testNamePattern) with a regex matched against the full test name — the enclosing describe names and the test name joined with ' > '. Appending :lineNumber to a full file path runs the test containing that line, and tags in test options plus --tags-filter run categorized tests. Inside files, .only focuses a test or suite and skips everything else there, and Vitest fails the run if .only appears in CI unless the allowOnly option permits it; .skip disables a test and .todo marks a placeholder. Filters apply per test file, so pass a file path alongside the filter to avoid loading every file. Scope: Vitest. Reviewed October 4, 2026.

Source and provenance

Original source
vitest.dev
Published on Koskamo by
Koskamo editorial
Citation version
Document v1
Reuse
Original summaries; linked sources retain their own terms.

The original source supplies the underlying information. Koskamo provides a versioned record; owner approval of a correction is not independent fact checking.