Skip to content

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.

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.

VitestDedup reads test.include, test.exclude, test.globals, project lists, and the typecheck channel from vitest.config.* and vite.config.* without executing them.

*.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 exclude list when none is written: node_modules, dist, build, coverage, .idea, .git, .cache, .output and .temp. Vitest’s default excludes only node_modules and .git.
  • Hidden (dot-prefixed) directories are skipped.
  • includeSource is additive: a file matching it is also scanned for in-source tests.

A config declaring test.projects, or a vitest.workspace.* file, is resolved entry by entry, honouring extends: false.

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:

Terminal window
vitest-dedup . --globals

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.