# vitest-dev/vitest — codebase unpack

> Canonical page: https://codevetter.com/unpack/vitest

This is a deterministic Repo Unpack scan of vitest-dev/vitest — a structural map, not a review, security audit, or maintainer-endorsed description.

- Scanned commit: 4ee66c021e0592c886dbab727f0f8da9366f99ab (2026-10-02)
- Last upstream commit: fix(runner): don't cache failed fixture setups (fix #11237) (#11238)
- Generated by codevetter 1.15.0 on 2026-10-02
- 3067 files scanned · 8.6 MB

Source inspection; upstream code and tests were not executed.

## Languages

- TypeScript: 2099 files
- JavaScript: 264 files
- Markdown: 264 files
- JSON: 153 files
- Vue: 73 files
- YAML: 29 files
- CSS: 14 files
- HTML: 14 files

## Repository structure

- test/ — 1968 files
- packages/ — 682 files
- docs/ — 293 files
- examples/ — 56 files
- .github/ — 32 files
- scripts/ — 7 files
- patches/ — 4 files
- .claude/ — 2 files

Probable source entrypoint: `packages/` (inferred from the tree, not upstream docs)

## Package

- package.json: @vitest/monorepo v5.0.3 — 22 declared dependencies

## Structural health signals

Average score 6.8/10 across 96 files; 40 hotspots. These are deterministic review leads, not proof of a bug.

## Recent history

- 4ee66c021e05 (2026-10-02) fix(runner): don't cache failed fixture setups (fix #11237) (#11238)
- af903c65e4d1 (2026-10-02) fix(ui): store module graph once per environment (#11421)
- a627be498c33 (2026-10-02) fix(ui): simplify explorer filtering + fix nested tests when search matches a suite (#11262)
- b4e79fd7a3c7 (2026-10-02) fix(expect): fix `Map` and `Set` deep equality in some assertions (#11402)
- b0f2b3bb9d81 (2026-10-02) fix: track project files and mocks with --changed (#11432)

## Overview

Vitest is an ESM-first testing framework for JavaScript and TypeScript applications that reuses Vite configuration, resolution, transforms, and plugins. At commit 4ee66c021e0592c886dbab727f0f8da9366f99ab, its Node coordinator resolves projects, schedules isolated workers or browser sessions, and aggregates test results, snapshots, coverage, and reports. Its distinctive combination is a familiar assertion and mocking API with configurable execution environments, real-browser testing, and a live Vue results interface.

## System map

The system has a Node coordinator, interchangeable execution workers, browser infrastructure, and an optional Vue interface. Configuration resolution precedes server attachment and test scheduling. Persistent state is held in filesystem artifacts and caches, while active task state belongs to coordinator and client state managers. Distribution consists of built package entrypoints plus a separately built documentation site.
- The executable vitest.mjs loads dist/cli.js; its source entrypoint calls createCLI().parse(), while package exports separately expose built public APIs. — [packages/vitest/vitest.mjs#L1-2](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/vitest.mjs#L1-L2) [packages/vitest/src/node/cli.ts#L1-3](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/cli.ts#L1-L3) [packages/vitest/package.json#L33-43](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/package.json#L33-L43)
- createVitest constructs Logger, VitestPackageInstaller, PluginHarness, and Vitest around resolveConfig; setup failures close the instance before rethrowing. — [packages/vitest/src/node/create.ts#L44-61](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/create.ts#L44-L61)
- resolveConfig installs capture, test-config, core, and browser-loader plugins into Vite resolution, then resolves Vitest configuration and project entries. — [packages/vitest/src/node/config/resolveConfig.ts#L1142-1168](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/config/resolveConfig.ts#L1142-L1168) [packages/vitest/src/node/config/resolveConfig.ts#L1227-1234](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/config/resolveConfig.ts#L1227-L1234)
- Vitest._start attaches root and project servers; _setRootConfig owns StateManager, VitestCache, SnapshotManager, tracing, resolver, and transform-service instances. — [packages/vitest/src/node/core.ts#L215-219](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/core.ts#L215-L219) [packages/vitest/src/node/core.ts#L239-264](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/core.ts#L239-L264)
- Pool worker selection supports forks, threads, VM variants, TypeScript checking, and a custom poolRunner; fork workers launch child processes with advanced IPC serialization. — [packages/vitest/src/node/pools/pool.ts#L265-287](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/pools/pool.ts#L265-L287) [packages/vitest/src/node/pools/workers/forksWorker.ts#L60-66](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/pools/workers/forksWorker.ts#L60-L66)
- Browser support contributes configuration, plugins, parent creation, and RPC to a core-created Vite server; Playwright and preview providers have separate package entrypoints. — [packages/browser/src/node/index.ts#L70-75](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/browser/src/node/index.ts#L70-L75) [packages/browser-playwright/src/index.ts#L1-7](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/browser-playwright/src/index.ts#L1-L7) [packages/browser-preview/src/index.ts#L1-2](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/browser-preview/src/index.ts#L1-L2)
- The Vue UI mounts through client/main.ts and chooses a live WebSocket client or static report client; live transport uses birpc and flatted serialization. — [packages/ui/client/main.ts#L1-15](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/ui/client/main.ts#L1-L15) [packages/ui/client/composables/client/index.ts#L27-33](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/ui/client/composables/client/index.ts#L27-L33) [packages/ui/client/composables/client/ws.ts#L40-59](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/ui/client/composables/client/ws.ts#L40-L59)
- Root scripts provide recursive package builds, linting, typechecking, and split test suites; VitePress builds documentation, and Netlify publishes docs/.vitepress/dist using pnpm ci:docs. — [package.json#L11-43](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/package.json#L11-L43) [docs/package.json#L5-15](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/docs/package.json#L5-L15) [netlify.toml#L1-9](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/netlify.toml#L1-L9)

## Feature catalog

The inspected public surface spans test authoring, command-line execution, project selection, browser testing, and result inspection. Assertions, mocking, fixtures, and snapshots integrate with the same runner lifecycle. Coverage and reporter outputs support both local feedback and CI consumption. The catalog groups related capabilities into eight areas and is bounded by the inspected sources.
- CLI commands include run, related, watch/dev, bench, init, doctor, and list; init accepts only browser, while list branches between collected tests and files-only output. — [packages/vitest/src/node/cli/cac.ts#L170-193](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/cli/cac.ts#L170-L193) [packages/vitest/src/node/cli/cac.ts#L340-351](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/cli/cac.ts#L340-L351) [packages/vitest/src/node/cli/cac.ts#L367-388](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/cli/cac.ts#L367-L388)
- Public APIs export describe/it/test/suite, before/after and around hooks, completion hooks, and artifact recording; test.extend supports fixture definitions with scoped dependency restrictions. — [packages/vitest/src/public/index.ts#L66-77](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/public/index.ts#L66-L77) [test/e2e/test/scoped-fixtures.test.ts#L31-65](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/test/e2e/test/scoped-fixtures.test.ts#L31-L65)
- The public assertion surface exports Chai, assert, expect, and vi; vi exposes fake timers, spies, and module mocking, and built-in environments include node, jsdom, happy-dom, and edge-runtime. — [packages/vitest/src/public/index.ts#L32-37](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/public/index.ts#L32-L37) [packages/vitest/src/integrations/vi.ts#L129-136](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/integrations/vi.ts#L129-L136) [packages/vitest/src/integrations/vi.ts#L258-271](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/integrations/vi.ts#L258-L271) [packages/vitest/src/integrations/env/index.ts#L7-17](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/integrations/env/index.ts#L7-L17)
- Snapshots support external files, inline source updates, and raw files; custom composable matchers include standard, file, and domain snapshot helpers. — [packages/snapshot/src/port/state.ts#L410-438](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/snapshot/src/port/state.ts#L410-L438) [packages/vitest/src/integrations/snapshot/chai.ts#L343-369](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/integrations/snapshot/chai.ts#L343-L369) [packages/vitest/src/integrations/snapshot/chai.ts#L417-462](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/integrations/snapshot/chai.ts#L417-L462)
- Projects can nest through container configurations and expand into browser-instance and benchmark variants; CLI selection includes related files, filename/location filters, and sequencer-based sharding. — [packages/vitest/src/node/projects/resolveProjects.ts#L82-108](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/projects/resolveProjects.ts#L82-L108) [packages/vitest/src/node/cli/cac.ts#L257-289](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/cli/cac.ts#L257-L289) [packages/vitest/src/node/pool.ts#L67-87](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/pool.ts#L67-L87)
- Browser testing integrates provider initialization and bounded session scheduling, with registered commands for filesystem operations, screenshots, screenshot matching, and trace recording. — [packages/browser/src/node/project.ts#L93-107](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/browser/src/node/project.ts#L93-L107) [packages/vitest/src/node/pools/browser.ts#L286-315](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/pools/browser.ts#L286-L315) [packages/browser/src/node/commands/index.ts#L6-17](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/browser/src/node/commands/index.ts#L6-L17)
- Coverage supports v8, Istanbul, and a custom provider module; built-in browser loading selects a /browser provider entrypoint, and run finalization generates and reports coverage. — [packages/vitest/src/utils/coverage.ts#L48-78](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/utils/coverage.ts#L48-L78) [packages/vitest/src/utils/coverage.ts#L81-98](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/utils/coverage.ts#L81-L98) [packages/vitest/src/node/core.ts#L1091-1096](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/core.ts#L1091-L1096)
- Results are available through dashboard, file details, coverage, browser, and trace UI components, plus JSON, JUnit, TAP, GitHub Actions, and blob reporters; mergeReports replays saved runs. — [packages/ui/client/pages/index.vue#L4-24](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/ui/client/pages/index.vue#L4-L24) [packages/vitest/src/node/reporters/index.ts#L40-54](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/reporters/index.ts#L40-L54) [packages/vitest/src/node/core.ts#L698-739](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/core.ts#L698-L739)

## Data flow

CLI arguments become resolved Vite and Vitest configuration before producing project-specific test specifications. Execution transports module requests toward the coordinator and task updates back from workers. Snapshot state remains local to a running file until its summary is aggregated, while result caches retain scheduling information across runs. The UI maintains its own reactive representation of coordinator events.
- CLI normalization converts exclude into cliExclude and enables locations for colon filters; prepareVitest sets TEST/VITEST and default NODE_ENV, then passes options into createVitest. — [packages/vitest/src/node/cli/cac.ts#L282-299](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/cli/cac.ts#L282-L299) [packages/vitest/src/node/cli/cli-api.ts#L234-249](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/cli/cli-api.ts#L234-L249)
- Project definitions become resolved entries; undefined definitions use the root entry, nested containers contribute tracked configuration paths, and duplicate project names are checked. — [packages/vitest/src/node/projects/resolveProjects.ts#L103-152](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/projects/resolveProjects.ts#L103-L152)
- Worker fetch requests enter createMethodsRPC.fetchModule and project._transformService.fetch; returned externalizations, temporary paths, and direct-fetch durations populate project metadata. — [packages/vitest/src/node/pools/rpc.ts#L36-45](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/pools/rpc.ts#L36-L45) [packages/vitest/src/node/pools/rpc.ts#L60-97](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/pools/rpc.ts#L60-L97)
- collectTests creates a file task, clears collector context, runs setupFiles, imports the test module, and assembles its collected tasks; specifications carry location, name, ID, and tag filters. — [packages/vitest/src/runtime/runner/collect.ts#L25-48](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/runtime/runner/collect.ts#L25-L48) [packages/vitest/src/runtime/runner/collect.ts#L54-92](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/runtime/runner/collect.ts#L54-L92)
- resolveTestRunner wraps task-update callbacks with worker RPC; coordinator handlers route collection and updates either directly into StateManager or through _testRun, depending on collection mode. — [packages/vitest/src/runtime/runners/index.ts#L62-67](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/runtime/runners/index.ts#L62-L67) [packages/vitest/src/node/pools/rpc.ts#L345-378](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/pools/rpc.ts#L345-L378)
- SnapshotClient stores SnapshotState by filepath, forwards matcher input into state.match, and finishes through state.pack; worker snapshotSaved results are added to the coordinator SnapshotManager. — [packages/snapshot/src/client.ts#L77-88](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/snapshot/src/client.ts#L77-L88) [packages/snapshot/src/client.ts#L175-190](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/snapshot/src/client.ts#L175-L190) [packages/vitest/src/node/pools/rpc.ts#L325-331](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/pools/rpc.ts#L325-L331)
- ResultsCache writes results.json under config.dir with versioned entries keyed by project name and root-relative filepath; each retained result stores duration and failure status. — [packages/vitest/src/node/cache/results.ts#L29-33](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/cache/results.ts#L29-L33) [packages/vitest/src/node/cache/results.ts#L72-84](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/cache/results.ts#L72-L84) [packages/vitest/src/node/cache/results.ts#L96-114](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/cache/results.ts#L96-L114)
- The live UI receives collected task trees, result packs, logs, artifacts, and completion events; it updates client state and explorer state, while static reports use a separate client factory. — [packages/ui/client/composables/client/index.ts#L27-75](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/ui/client/composables/client/index.ts#L27-L75) [packages/ui/client/composables/client/ws.ts#L40-59](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/ui/client/composables/client/ws.ts#L40-L59)

## Behavior traces

Three core flows were followed across their implementing files: CLI startup, primary test execution, and snapshot persistence. Additional traces cover UI authentication, report replay, and shutdown. Ordering matters because configuration, servers, workers, reporters, and filesystem artifacts have separate lifetimes. These are source-derived walkthroughs, not observed runtime executions.
- Startup begins vitest.mjs → cli.ts → createCLI().parse() → run/start → startVitest → prepareVitest; run preserves watch mode when --watch is supplied. — [packages/vitest/vitest.mjs#L1-2](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/vitest.mjs#L1-L2) [packages/vitest/src/node/cli.ts#L1-3](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/cli.ts#L1-L3) [packages/vitest/src/node/cli/cac.ts#L268-272](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/cli/cac.ts#L268-L272) [packages/vitest/src/node/cli/cac.ts#L302-310](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/cli/cac.ts#L302-L310)
- prepareVitest → createVitest → resolveConfig → new Vitest → _start → _setRootConfig → _attachRootServer → _attachProjectServers establishes the coordinator before startVitest invokes start or an alternate maintenance mode. — [packages/vitest/src/node/cli/cli-api.ts#L146-156](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/cli/cli-api.ts#L146-L156) [packages/vitest/src/node/cli/cli-api.ts#L234-249](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/cli/cli-api.ts#L234-L249) [packages/vitest/src/node/create.ts#L44-55](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/create.ts#L44-L55) [packages/vitest/src/node/core.ts#L215-219](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/core.ts#L215-L219)
- Vitest.start initializes coverage and reporters, discovers specifications, optionally preparses them, populates file statistics, and calls runFiles; empty discovery has special changed/related watch handling. — [packages/vitest/src/node/core.ts#L858-892](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/core.ts#L858-L892) [packages/vitest/src/node/core.ts#L895-925](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/core.ts#L895-L925)
- runFiles creates the pool, clears invalidations/snapshot/errors, initializes global setup, and calls pool.runTests; worker run resolves runner/environment/coverage concurrently, then startTests collects modules and runs suites. — [packages/vitest/src/node/core.ts#L1056-1077](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/core.ts#L1056-L1077) [packages/vitest/src/runtime/runBaseTests.ts#L28-42](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/runtime/runBaseTests.ts#L28-L42) [packages/vitest/src/runtime/runBaseTests.ts#L52-81](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/runtime/runBaseTests.ts#L52-L81) [packages/vitest/src/runtime/runner/run.ts#L1039-1052](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/runtime/runner/run.ts#L1039-L1052)
- Snapshot persistence follows TestRunner.onBeforeRunSuite → SnapshotClient.setup → SnapshotState.create, then matcher delegation → SnapshotClient.match; suite completion calls finish → pack → save and reports snapshotSaved. — [packages/vitest/src/runtime/runners/test.ts#L154-162](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/runtime/runners/test.ts#L154-L162) [packages/vitest/src/integrations/snapshot/chai.ts#L276-299](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/integrations/snapshot/chai.ts#L276-L299) [packages/snapshot/src/client.ts#L77-88](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/snapshot/src/client.ts#L77-L88) [packages/snapshot/src/port/state.ts#L607-633](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/snapshot/src/port/state.ts#L607-L633)
- SnapshotState.save selects external, inline, or raw persistence; external saveSnapshotFile sorts and serializes entries, skips identical content, and NodeSnapshotEnvironment creates directories and writes UTF-8. — [packages/snapshot/src/port/state.ts#L410-438](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/snapshot/src/port/state.ts#L410-L438) [packages/snapshot/src/port/utils.ts#L104-126](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/snapshot/src/port/utils.ts#L104-L126) [packages/snapshot/src/env/node.ts#L31-40](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/snapshot/src/env/node.ts#L31-L40)
- UI login validates ?token=, sets an HttpOnly SameSite=strict cookie, redirects to the clean UI base, and injects the API token into authorized HTML; WebSocket upgrades separately require isValidApiRequest. — [packages/ui/node/index.ts#L41-84](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/ui/node/index.ts#L41-L84) [packages/ui/node/index.ts#L140-162](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/ui/node/index.ts#L140-L162) [packages/vitest/src/api/setup.ts#L44-62](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/api/setup.ts#L44-L62)
- Report replay reads blobs, reconstructs specifications, replays file events, and merges coverage; shutdown waits for the active run, tears down global setup in reverse project order, closes the pool, then closes project servers. — [packages/vitest/src/node/core.ts#L698-739](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/core.ts#L698-L739) [packages/vitest/src/node/core.ts#L1645-1691](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/core.ts#L1645-L1691)

## Testing signals

Tests and CI were inspected, not executed; test existence does not establish a passing result. The sampled tests exercise runner behavior, snapshots, API authentication, browser permissions, and lifecycle regressions. CI definitions provide platform and Node-version coverage, with separate browser jobs. Inspection also revealed conditional skips and typecheck exclusions, so the inventory is bounded rather than exhaustive coverage.
- Root pnpm test selects the unit threads script; unit configuration also defines forks and vmThreads projects, virtual-module plugins, snapshot-path customization, coverage, and typechecking. — [package.json#L28-33](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/package.json#L28-L33) [test/unit/vite.config.ts#L10-39](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/test/unit/vite.config.ts#L10-L39) [test/unit/vite.config.ts#L134-155](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/test/unit/vite.config.ts#L134-L155) [test/unit/vite.config.ts#L196-207](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/test/unit/vite.config.ts#L196-L207)
- E2E suites use Vitest and runInlineTests; restart-coalescing.test.ts requests three simultaneous restarts and verifies a subsequent rerun remains functional. — [test/e2e/test/watch/restart-coalescing.test.ts#L1-32](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/test/e2e/test/watch/restart-coalescing.test.ts#L1-L32) [test/test-utils/index.ts#L749-777](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/test/test-utils/index.ts#L749-L777)
- Snapshot CI tests spawn the CLI with CI enabled and expect a missing-snapshot failure, then disable CI and expect snapshot creation; these expectations were inspected only. — [test/e2e/snapshots/ci.test.ts#L6-41](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/test/e2e/snapshots/ci.test.ts#L6-L41) [test/e2e/snapshots/ci.test.ts#L43-58](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/test/e2e/snapshots/ci.test.ts#L43-L58)
- Token tests cover reuse, empty or whitespace content, publication consistency, and intermediate-file cleanup; Playwright UI tests cover unauthenticated HTML/coverage rejection, token-file serving denial, and cookie bootstrap. — [test/unit/test/api-token.test.ts#L24-60](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/test/unit/test/api-token.test.ts#L24-L60) [test/ui/test/ui.spec.ts#L62-137](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/test/ui/test/ui.spec.ts#L62-L137) [test/ui/playwright.config.ts#L1-16](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/test/ui/playwright.config.ts#L1-L16)
- Browser permission tests disable allowExec and allowWrite, then check filesystem-command failures, suppressed attachments, and blocked snapshot evaluation/saving; UI tests separately exercise disabled writes and execution. — [test/browser/specs/errors.test.ts#L79-139](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/test/browser/specs/errors.test.ts#L79-L139) [test/ui/test/ui.spec.ts#L912-944](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/test/ui/test/ui.spec.ts#L912-L944)
- The large scoped-fixture suite checks invalid fixture dependencies, but installs a beforeEach skip when rolldownVersion is present, limiting what that suite exercises on that branch. — [test/e2e/test/scoped-fixtures.test.ts#L22-65](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/test/e2e/test/scoped-fixtures.test.ts#L22-L65)
- CI defines Linux unit/e2e/coverage jobs on Node 24/26, a Node 22 e2e floor, macOS e2e, Windows suite legs, and separate Windows/Linux browser jobs; lint CI checks generated artifacts and UI types. — [.github/workflows/ci.yml#L47-64](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/.github/workflows/ci.yml#L47-L64) [.github/workflows/ci.yml#L148-183](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/.github/workflows/ci.yml#L148-L183) [.github/workflows/ci.yml#L241-255](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/.github/workflows/ci.yml#L241-L255) [.github/workflows/ci.yml#L289-313](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/.github/workflows/ci.yml#L289-L313)
- Root TypeScript checking excludes e2e, browser, TypeScript-test, docs, and example paths; node-runner instead declares node --test, and UI client checking uses a separate vue-tsc script. — [tsconfig.check.json#L6-20](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/tsconfig.check.json#L6-L20) [test/node-runner/package.json#L2-9](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/test/node-runner/package.json#L2-L9) [packages/ui/package.json#L43-48](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/ui/package.json#L43-L48)

## Risk map

The inspected sensitive boundaries include authenticated HTTP/WebSocket APIs, browser filesystem commands, executable snapshots, child processes, and persistent user-data files. Several paths already contain explicit permission checks and regression tests. The observations below identify review hotspots and existing safeguards, not confirmed vulnerabilities. Lifecycle and coverage hypotheses require targeted execution in a separately authorized environment.
- API tokens persist first in a platform-specific user-data directory, with workspace node_modules/.vitest fallback; creation uses UUIDs and restrictive modes, while configuration adds the token filename to Vite's deny list. — [packages/vitest/src/node/config/apiToken.ts#L19-26](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/config/apiToken.ts#L19-L26) [packages/vitest/src/node/config/apiToken.ts#L43-74](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/config/apiToken.ts#L43-L74) [packages/vitest/src/node/config/apiToken.ts#L77-93](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/config/apiToken.ts#L77-L93) [packages/vitest/src/node/config/resolveConfig.ts#L1170-1178](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/config/resolveConfig.ts#L1170-L1178)
- API authentication uses a query token with timingSafeEqual; UI authentication additionally accepts a year-long HttpOnly strict cookie and injects the token into authorized HTML, making token-handling paths security-sensitive. — [packages/vitest/src/api/check.ts#L5-18](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/api/check.ts#L5-L18) [packages/ui/node/index.ts#L41-84](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/ui/node/index.ts#L41-L84) [packages/ui/node/index.ts#L140-159](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/ui/node/index.ts#L140-L159)
- Non-middleware API hosts other than localhost/127.0.0.1 default write and execute capabilities off; explicit settings remain effective, and API rerun, file-save, and snapshot-update handlers apply separate capability checks. — [packages/vitest/src/node/config/resolveConfig.ts#L137-150](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/config/resolveConfig.ts#L137-L150) [packages/vitest/src/api/setup.ts#L80-104](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/api/setup.ts#L80-L104) [packages/vitest/src/api/setup.ts#L174-184](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/api/setup.ts#L174-L184)
- Browser filesystem commands resolve paths against project.root and check file access; writes/removals additionally assert write permission, while browser RPC requires both project and root capabilities for CDP. — [packages/browser/src/node/commands/fs.ts#L8-45](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/browser/src/node/commands/fs.ts#L8-L45) [packages/browser/src/node/rpc.ts#L198-222](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/browser/src/node/rpc.ts#L198-L222)
- Snapshot loading can execute file content through new Function('exports', content); Node raw snapshots accept absolute paths, and SnapshotClient documents that its same-file collision rejection is best-effort. — [packages/snapshot/src/port/utils.ts#L30-42](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/snapshot/src/port/utils.ts#L30-L42) [packages/snapshot/src/port/state.ts#L141-150](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/snapshot/src/port/state.ts#L141-L150) [packages/snapshot/src/env/node.ts#L16-24](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/snapshot/src/env/node.ts#L16-L24) [packages/snapshot/src/client.ts#L131-138](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/snapshot/src/client.ts#L131-L138)
- Execution crosses process and command boundaries: fork workers receive env/execArgv, Git discovery invokes git through tinyexec, and interactive missing-dependency handling can call installPackage after confirmation. — [packages/vitest/src/node/pools/workers/forksWorker.ts#L60-66](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/pools/workers/forksWorker.ts#L60-L66) [packages/vitest/src/node/vcs/git.ts#L49-70](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/vcs/git.ts#L49-L70) [packages/vitest/src/node/packageInstaller.ts#L36-54](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/packageInstaller.ts#L36-L54)
- Lifecycle ordering is a coupling hotspot: source comments identify overlapping restarts and browser reconnection during shutdown as failure mechanisms; serialization of restarts and pool-before-server closure are intended safeguards. — [packages/vitest/src/node/core.ts#L270-277](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/core.ts#L270-L277) [packages/vitest/src/node/core.ts#L1648-1675](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/core.ts#L1648-L1675) [test/e2e/test/watch/restart-coalescing.test.ts#L4-32](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/test/e2e/test/watch/restart-coalescing.test.ts#L4-L32)
- Hypothesis: relying on root typecheck or the scoped-fixture suite alone can miss branch-specific regressions, because several test trees are excluded and scoped-fixture tests skip under rolldownVersion. (inferred) — [tsconfig.check.json#L6-20](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/tsconfig.check.json#L6-L20) [test/e2e/test/scoped-fixtures.test.ts#L22-28](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/test/e2e/test/scoped-fixtures.test.ts#L22-L28) [.github/workflows/ci.yml#L60-64](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/.github/workflows/ci.yml#L60-L64)

## Extension points

Extension contracts span Vite plugins, runners, worker factories, environments, coverage providers, reporters, and browser commands. Most are configuration-selected and resolved before or during execution. Coordinator and worker hooks occupy different runtime boundaries, so extensions must preserve serialization and lifecycle rules. Snapshot customization additionally separates matching from storage.
- configureVitest receives project, vitest, injectTestProjects, and defineCacheKeyGenerator; it runs before reporter initialization, and resolved configuration mutations are not automatically re-resolved. — [packages/vitest/src/node/types/plugin.ts#L6-24](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/types/plugin.ts#L6-L24) [packages/vitest/src/node/core.ts#L391-400](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/core.ts#L391-L400) [docs/api/advanced/plugin.md#L60-84](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/docs/api/advanced/plugin.md#L60-L84)
- config.runner selects a default-exported runner constructor; resolveTestRunner requires importFile, injects moduleRunner, loads serializers/diff options, and wraps callbacks to preserve Vitest RPC reporting. — [packages/vitest/src/runtime/runners/index.ts#L11-67](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/runtime/runners/index.ts#L11-L67) [docs/api/advanced/runner.md#L7-18](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/docs/api/advanced/runner.md#L7-L18)
- Custom worker execution plugs into project.config.poolRunner through a matching name and createPoolWorker(options), after built-in worker choices are exhausted. — [packages/vitest/src/node/pools/pool.ts#L265-287](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/pools/pool.ts#L265-L287)
- Custom environments resolve from a path or vitest-environment-{name}; loading branches between native and Vite module runners and validates the default export and supplied transformMode. — [packages/vitest/src/integrations/env/loader.ts#L76-96](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/integrations/env/loader.ts#L76-L96) [packages/vitest/src/integrations/env/loader.ts#L108-138](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/integrations/env/loader.ts#L108-L138)
- Coverage extension modules supply getProvider and optional start/take/stopCoverage hooks; customProviderModule loads through the supplied loader and must provide a default export. — [packages/vitest/src/utils/coverage.ts#L17-45](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/utils/coverage.ts#L17-L45) [packages/vitest/src/utils/coverage.ts#L81-98](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/utils/coverage.ts#L81-L98) [packages/vitest/src/node/coverage.ts#L67-77](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/coverage.ts#L67-L77)
- Browser commands extend a built-in registry through config.browser.commands with identifier validation; triggerCommand prefers project commands, then parent commands, and rejects unsupported names. — [packages/browser/src/node/projectParent.ts#L110-121](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/browser/src/node/projectParent.ts#L110-L121) [packages/browser/src/node/project.ts#L72-83](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/browser/src/node/project.ts#L72-L83) [packages/browser/src/node/index.ts#L42-45](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/browser/src/node/index.ts#L42-L45)
- ReportersMap is the built-in output registry, while config.sequence.sequencer supplies shard and sort behavior before execution grouping; these are separate presentation and scheduling extension boundaries. — [packages/vitest/src/node/reporters/index.ts#L40-56](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/reporters/index.ts#L40-L56) [packages/vitest/src/node/pool.ts#L53-87](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/pool.ts#L53-L87)
- Snapshot customization includes composable matcher helpers and storage environments; SnapshotState.create can consume readSnapshotFileData directly instead of evaluating text, and NodeSnapshotEnvironment accepts a custom snapshot-directory name. — [packages/vitest/src/integrations/snapshot/chai.ts#L343-369](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/integrations/snapshot/chai.ts#L343-L369) [packages/vitest/src/integrations/snapshot/chai.ts#L450-488](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/integrations/snapshot/chai.ts#L450-L488) [packages/snapshot/src/port/state.ts#L141-151](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/snapshot/src/port/state.ts#L141-L151) [packages/snapshot/src/env/node.ts#L20-24](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/snapshot/src/env/node.ts#L20-L24)

## Contributor handoff

Tests and CI were inspected, not executed, and this brief must not be treated as a passing validation record. Begin edits with the nearest instructions and the implementing runtime boundary, then choose the corresponding test project. Built distribution files, generated documentation, helper defaults, and conditional skips are important interpretation traps. The present assignment authorizes source inspection only; development commands below describe future workflows requiring appropriate task authorization.
- Read AGENTS.md and CONTRIBUTING.md before contribution work; external PRs, issues, or comments require manual operator approval, and contribution policy requires real-person ownership and AI disclosure. — [AGENTS.md#L5-13](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/AGENTS.md#L5-L13) [CONTRIBUTING.md#L84-94](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/CONTRIBUTING.md#L84-L94) [CONTRIBUTING.md#L120-128](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/CONTRIBUTING.md#L120-L128)
- Use repository pnpm scripts and the declared Node range; package.json pins pnpm@11.28.2 and exposes build, lint, typecheck, unit, e2e, coverage, and browser checks. — [package.json#L6-43](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/package.json#L6-L43) [CONTRIBUTING.md#L5-25](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/CONTRIBUTING.md#L5-L25)
- For core changes, first read create.ts, resolveConfig.ts, and the relevant core.ts lifecycle; worker changes require runtime/runBaseTests.ts and runner/run.ts because scheduling and test callbacks live in different processes. — [packages/vitest/src/node/create.ts#L44-61](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/create.ts#L44-L61) [packages/vitest/src/node/core.ts#L1044-1077](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/node/core.ts#L1044-L1077) [packages/vitest/src/runtime/runBaseTests.ts#L18-42](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/runtime/runBaseTests.ts#L18-L42) [packages/vitest/src/runtime/runner/run.ts#L1039-1052](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/src/runtime/runner/run.ts#L1039-L1052)
- Rebuild before executing tests against package changes: public exports resolve dist, mocker is not inlined, runtime workers are built separately, and watch builds omit declaration bundling. — [packages/vitest/package.json#L33-43](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/package.json#L33-L43) [packages/vitest/rollup.config.js#L35-42](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/rollup.config.js#L35-L42) [packages/vitest/rollup.config.js#L55-87](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/packages/vitest/rollup.config.js#L55-L87) [AGENTS.md#L65-73](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/AGENTS.md#L65-L73)
- Choose the smallest relevant filtered test command without an extra --; root test covers the unit threads selection, whereas browser execution has a separate test:browser:playwright script. — [AGENTS.md#L42-58](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/AGENTS.md#L42-L58) [package.json#L28-43](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/package.json#L28-L43) [test/browser/package.json#L5-8](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/test/browser/package.json#L5-L8)
- Use runInlineTests for mutable multi-file setups; runVitest defaults cache off, one worker, watch off, verbose reporting, and NO_COLOR, with $cliOptions applied as overrides. — [AGENTS.md#L75-86](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/AGENTS.md#L75-L86) [test/test-utils/index.ts#L197-229](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/test/test-utils/index.ts#L197-L229) [test/test-utils/index.ts#L749-777](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/test/test-utils/index.ts#L749-L777)
- Root typecheck does not cover all test trees or UI client code; CLI option edits require regenerating cli-generated.md, and CI checks stale build artifacts plus separate UI typechecking. — [tsconfig.check.json#L6-20](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/tsconfig.check.json#L6-L20) [docs/AGENTS.md#L23-26](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/docs/AGENTS.md#L23-L26) [AGENTS.md#L218-222](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/AGENTS.md#L218-L222) [.github/workflows/ci.yml#L47-64](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/.github/workflows/ci.yml#L47-L64)
- Keep mutable fixtures isolated, use test-utils edits for watch tests, serialize Git-dependent fixtures, normalize Windows paths, and check focused tests manually; formatting uses oxfmt and fixture trees are excluded. — [AGENTS.md#L88-93](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/AGENTS.md#L88-L93) [test/e2e/vitest.config.ts#L5-15](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/test/e2e/vitest.config.ts#L5-L15) [.oxfmtrc.jsonc#L3-18](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/.oxfmtrc.jsonc#L3-L18) [.oxfmtrc.jsonc#L27-35](https://github.com/vitest-dev/vitest/blob/4ee66c021e0592c886dbab727f0f8da9366f99ab/.oxfmtrc.jsonc#L27-L35)

Source repository: https://github.com/vitest-dev/vitest
Full evidence corpus: https://github.com/Codevetter/codevetter/tree/main/benchmarks/repo-unpacks/vitest.json

## Public product links

- [CodeVetter](https://codevetter.com/)
- [Download](https://codevetter.com/download)
- [Documentation](https://codevetter.com/docs/)
- [Source](https://github.com/Codevetter/codevetter)
