Configuration
A .vitest-dedup.json file is found by walking upward from the analyzed directory, or named with
--config. Command-line flags override it.
{ "include": ["src/**/*.test.ts"], "exclude": ["**/fixtures/**"], "threshold": 0, "rules": { "subsumed-test": "warning" }}Every key is optional, and an unknown key is an error.
| Key | Meaning |
|---|---|
include, exclude |
Globs relative to the analyzed directory. |
threshold |
A percentage from 0 to 100. |
rules |
Maps a rule id to off, warning, or error. |
Files matched by .gitignore or by a .vitest-dedupignore file in the same syntax are skipped as
well.
Glob semantics
Section titled “Glob semantics”Single * and ? wildcards stay within a path component; use ** to match across directories.
This also applies to resolved Vitest project globs and project paths, and to the base revision
--baseline-from-ref reads.
How Vitest configuration is read
Section titled “How Vitest configuration is read”VitestDedup reads test.include, test.exclude, test.globals, project lists, and the typecheck
channel from vitest.config.* and vite.config.* without executing them.
Test file naming
Section titled “Test file naming”*.test.* and *.spec.* are recognized by default. A Vitest config that declares its own include
replaces that list, so a project naming **/*.unit.ts gets exactly those files. An include written
in .vitest-dedup.json is an instruction and is never widened by a project’s broader list.
Differences from the set Vitest runs:
- The analyzer applies its own default
excludelist when none is written:node_modules,dist,build,coverage,.idea,.git,.cache,.outputand.temp. Vitest’s default excludes onlynode_modulesand.git. - Hidden (dot-prefixed) directories are skipped.
includeSourceis additive: a file matching it is also scanned for in-source tests.
Monorepos
Section titled “Monorepos”A config declaring test.projects, or a vitest.workspace.* file, is resolved entry by entry,
honouring extends: false.
Globals
Section titled “Globals”globals: true is detected from the resolved config. When the project list is built in a way no
static reader can follow — a bare variable, or mergeConfig with a dynamic import — the setting is
reported as undetermined and the flag is needed:
vitest-dedup . --globalsRuns that analyze no tests
Section titled “Runs that analyze no tests”When no executable tests are analyzed and no quality-gate failure applies, the command exits with
operational-error code 2 instead of treating an empty report as clean. If test-shaped files were read
but yielded no tests, the diagnostic suggests checking test.globals (or --globals) and build-time
transforms such as auto-imports — without claiming either cause was proved.