Skip to content
PluginStats

vitest-affected weekly downloads statistics

By craigvandotcom · npm · Testing

Intelligent test selection for Vitest — run only the tests affected by your changes

View on npm Stale · Oct 17, 2026

vitest-affected has 36 recorded weekly downloads on npm, a decrease of 90.0% over the past 30 days, ranking #1780 of 2,256 tracked listings.

Weekly downloads
36
Official API · Oct 17, 2026
7-day growth
-85.8%
-217 weekly downloads
30-day growth
-90.0%
-323 weekly downloads
90-day growth
+350%
+28 weekly downloads
Rank
#1780
Among tracked npm listings

About vitest-affected

vitest-affected

Run only the tests affected by your changes. Zero config, runtime dependency tracking, ~5ms selection overhead.

Why

Test more often, not just faster.

If you're running AI coding agents — or multiple agents in parallel — each one needs to verify its changes with tests. On a large codebase, running the full suite after every change is either painfully slow or impossible (machine melts). So you skip tests, and bugs slip through.

vitest-affected makes it practical to test after every single change. Each agent runs ~20 tests in seconds instead of 2,771 tests in minutes. You get continuous verification without overloading your machine.

It works by using Vitest's own runtime import data to build an exact reverse dependency map, diffing it against git, and walking the graph to find exactly which tests are impacted. If you change a utility buried three imports deep, only the tests that transitively depend on it will run.

If anything fails — git error, corrupt cache, incomplete graph — it falls back to the full suite with a warning. It never silently skips tests.

Features

• Runtime dependency tracking — uses Vitest's importDurations for exact, real-world dependency data • Transitive dependency tracking — BFS reverse-walk catches changes buried deep in the import chain • ~5ms selection overhead — delta-parse only changed files, load cached reverse map, BFS select • Persistent cache — reverse dependency map saved to .vitest-affected/graph.json, survives CI runs • Self-healing — cache updates after every run via runtime reporter; stale edges automatically pruned • Config-change detection — package.json, tsconfig.json, vitest.config.*, lockfile changes trigger full suite • Safe by default — any failure falls back to full suite, deleted files handled as BFS seeds • Silent-starvation heartbeats — a completed run that collects zero dependency edges, or a selective run that ran a test it didn't select, is flagged loudly (the failure mode that silently no-op'd the plugin for weeks is now observable) • Shadow mode — run the full pipeline without mutating include, so a single CI run yields ground truth and the would-be selection — the basis for CI divergence monitoring • Explain trail — ask why any test is (or isn't) selected, via the explain option or the vitest-affected-explain CLI • Observability — optional JSON-line stats log for every run

Install

Setup

That's it. On your next vitest run, only affected tests execute.

How It Works

  1. First run — no cache exists, so the full suite runs. A runtime reporter captures every module each test imports via importDurations, building an exact reverse dependency map. This is saved to disk. 2. Subsequent runs — the cached reverse map is loaded (~1ms). Git diff identifies changed files. A fast delta-parse with oxc-parser checks changed files for new imports not yet in the cache (~5ms for 1-5 files). BFS walks the reverse map to find affected tests. 3. After every run — the runtime reporter updates the cache with fresh dependency data. Stale edges (removed imports) are automatically pruned via per-test overwrite.

Options

Environment variables

Three env vars override config without editing it — useful in CI:

| Variable | Effect |

| VITEST_AFFECTED_DISABLED=1 | Fully inert — no selection, no shadow, no stats line. The rollback kill switch; wins over everything. | | VITEST_AFFECTED_SHADOW=1 | Force shadow mode (run everything, log the would-be selection). DISABLED still wins. | | VITEST_AFFECTED_STATS_FILE= | Force stats output to , overriding the config statsFile — so a CI step can point stats at a run-scoped file. |

Default ignored paths

The plugin filters obviously-irrelevant changed files before graph analysis to remove noise (parse warnings, "not in graph" warnings) for files that can never participate in the dependency graph. Built-in defaults:

• Path prefixes: .claude/, .git/, .next/, .vitest-affected/, playwright-report/, test-results/ • Basenames: .gitleaksignore, .prettierignore, next-env.d.ts • Extensions: anything outside the code-extension allowlist (markdown, images, CSS, etc.)

Config-file basenames (package.json, tsconfig.json, vitest.config.*, lockfiles) always pass through and trigger a full-suite run, regardless of any ignore rule.

Fixtures & assets: the dependency graph only follows import edges. A test that reads a fixture via fs.readFile, or an asset pulled in through Vite assetsInclude (e.g. .md), has no edge pointing back from that file to its dependents — so changing it would select too few tests (an under-run). Declare such paths in fullSuiteTriggers to force a full-suite run when they change.

Coupling channels

How does a change to file A end up selecting test T? Through a coupling channel — some link that makes T depend on A. This table is the honest accounting of every channel and how vitest-affected treats it. Verdicts:

• TRACKED — selection follows this channel exactly; no action needed. • FALLBACK-COVERED — not followed by the import graph, but covered once its runtime edge is recorded, or via an opt-in escape hatch. • BY-DESIGN — deliberately not an edge; selecting through it would be wrong. • DOCUMENTED-LIMITATION — a real gap with no automatic coverage; use the noted recipe.

| Channel | Verdict | How |…

Description from the npm listing.

  • vitest
  • test-selection
  • test-impact-analysis
  • dependency-graph
  • affected-tests
  • vitest-plugin

README badge

Show your rank in a README or on your website. The badge updates automatically.

Charts

Images: 30d · 1y · all time · 1600×900 dark

Adoption over time

vitest-affected weekly downloads on npm, last 90 days: 36 weekly downloads as of Oct 17, 2026, +350% over 90 days.vitest-affectedWeekly downloads on npm · Last 90 days36downloads / week+350% over 90 days02004006008001K1.2K1.4KJul 19Aug 3Aug 18Sep 2Sep 17Oct 2Oct 17downloads / weekobservedarchived (Internet Archive)no observationsJul 22, 2026 – Oct 17, 2026 · 88 observations · Updated Oc…pluginstats.com
vitest-affected weekly downloads on npm, last 90 days: 36 weekly downloads as of Oct 17, 2026, +350% over 90 days.

7/30/90-day growth

vitest-affected weekly downloads growth on npm: -85.8% over 7 days, -90.0% over 30 days, +350% over 90 days.vitest-affectedWeekly downloads growth on npm36downloads / week now7-day growth-217 weekly downloads-85.8%30-day growth-323 weekly downloads-90.0%90-day growth+28 weekly downloads+350%Growth vs. nearest observation to each baseline date · Updated Oct 17, 2026pluginstats.com
vitest-affected weekly downloads growth on npm: -85.8% over 7 days, -90.0% over 30 days, +350% over 90 days.

Ranking history

vitest-affected npm ranking history: currently #1780 (by weekly downloads).vitest-affectednpm ranking · by weekly downloads · Last 90 days#1780current rank#1772#1774#1776#1778#1780#1782Jul 21Aug 5Aug 20Sep 4Sep 19Oct 4Oct 19rankOct 18, 2026 – Oct 19, 2026 · 2 observations · Updated Oct 17, 2026pluginstats.com
vitest-affected npm ranking history: currently #1780 (by weekly downloads).

Listing placement

All npm2,256 listings · 113 pages · 1,129 shown · page 90, #1 (overall #1,781)
All npm: every listing in weekly downloads order

Listing placement

Testing21 listings · 2 pages · page 1, #8 (overall #8)
Testing: every listing in weekly downloads order

Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.

Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.

Recent observations

Full history (121)
Recent weekly downloads observations for vitest-affected
Date (UTC)Weekly downloadsChange vs. previous
36-8
44-41
85-36
121-25
1460
146+19
127-126
253-158
411-231
642-248
890-130
1,020-117
1,137-84
1,221—

Similar npm Testing plugins

All 20 vitest-affected alternatives

Data source

Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.

Listing: https://www.npmjs.com/package/vitest-affected. First seen Oct 16, 2026; last successful collection Oct 19, 2026. See the methodology.