# Data flow — vitest-dev/vitest

> Canonical page: https://codevetter.com/unpack/vitest/data-flow

# Data flow — vitest-dev/vitest

Scanned commit 4ee66c021e0592c886dbab727f0f8da9366f99ab (2026-10-02). Generated by codevetter codevetter 1.15.0 on 2026-10-02.

Source inspection; upstream code and tests were not executed.

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)

Every claim links to its cited files at the pinned commit. Citations identify source evidence; they do not establish runtime correctness. Independent CodeVetter scan — not reviewed by upstream maintainers.

## Public product links

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