Vite-native runner - Vitest runs tests through the same Vite pipeline as the app: one transform, plugins, aliases; no separate test build is needed.
vitest.config - Config in the test section (in vitest.config.ts or the Vite config); minimal and explainable, since every global option affects the whole suite.
environment - The test execution environment: node (default), jsdom or happy-dom for the DOM; Browser Mode is configured separately.
vi.fn / vi.spyOn - vi.fn is a standalone mock function (call history, set return value); vi.spyOn wraps a real method and calls the original by default.
vi.mock / vi.hoisted / vi.doMock - vi.mock replaces a module and is hoisted above imports; vi.hoisted prepares values for it; vi.doMock is not hoisted and applies to the next dynamic import.
Fake timers - Replacing timers and the clock (vi.useFakeTimers, vi.setSystemTime, vi.advanceTimersByTime) for determinism: time is advanced manually rather than waited on.
expectTypeOf - Type-level assertions (expectTypeOf/assertType) run during typecheck (vitest --typecheck); they catch signature regressions, not value ones.
bench - A built-in benchmark (bench/describe.bench) to measure a function's performance across versions; separate from regular tests.
In-source testing - Tests next to the code via import.meta.vitest; stripped out at build time. Handy for small pure functions.
Test Projects - Several configurations in one run (different environments/monorepo packages), each with its own environment, plugins and setup.
pool - The worker isolation model: threads (fast), forks (safer for native modules), vmThreads; change only when measurement justifies it.
Browser Mode - Running tests natively in a real browser (Playwright/WebdriverIO provider) - real layout, events and browser APIs instead of jsdom emulation.
Coverage - The share of code executed during a run (v8 provider); it shows a line ran, not that its behavior was checked by an assertion.
Snapshot - A stored reference of output (toMatchSnapshot/toMatchInlineSnapshot); useful as a reviewable contract for a small result, harmful as a DOM dump.
- Queries the UI by accessible name and role rather than implementation details; tests the interface through the user's eyes, including renderHook for hooks.
Testing Library
Flaky test - A test that fails non-deterministically (time, order, network, races, shared state); it is a defect, not randomness to blindly retry.