dánwòdánwò

Running

Changed tests

Run only the tests a change can affect, and see why each one was picked.

danwo test --changed runs only the tests your change can affect. It knows what each test touched in its last passing run, so a change to your webhook handler runs the tests that got that webhook, and a change to the README runs nothing.

Run it

npx @danwo/cli test --changed                    # uncommitted changes
npx @danwo/cli test --changed --since origin/main # everything since main

How a test gets picked

A changed file picks a test when:

  • it's the test file, or a file the test imports;
  • a rule in your config maps it to a page, provider host, call or webhook the test touched.

A change nothing explains picks every test, so a lockfile or config change never skips one. Markdown, plain text and docs/ pick none.

Map your source to what tests touch

Rules map globs to what a change there affects:

danwo.config.ts
import { defineConfig } from "@danwo/sdk"

export default defineConfig({
  impact: {
    rules: {
      "src/webhooks.ts": ["webhook checkout.session.completed"],
      "src/billing/**": ["api.stripe.com"],
      "src/pages/checkout/**": ["/checkout"],
      "src/server.ts": ["/"],
    },
  },
})
TargetPicks the tests that
/checkoutvisited /checkout or a page under it
/visited any page
api.stripe.comcalled that host
POST api.stripe.com/v1/checkout/sessionsmade that call
webhook checkout.session.completedreceived that webhook

A test with no data yet is picked by every rule that matches.

See why

danwo impact prints what a change would pick, without running anything:

npx @danwo/cli impact src/webhooks.ts
selected: 1 of 2 tests
  tests/buy-credits.danwo.ts › buys 500 credits through Stripe Checkout
      src/webhooks.ts (src/webhooks.ts) → webhook checkout.session.completed
matrix: danwo matrix tests/buy-credits.danwo.ts

The last line is the matrix for the picked tests, to run when the change touches payments.

npx @danwo/cli impact README.md
ignored: README.md (no test depends on it)
selected: 0 of 2 tests

Keep the index

Each passing test writes what it touched to .danwo/impact.json. The file is sorted and has no timestamps, so commit it: CI then picks tests from the same data you do.

OptionDefault
impact.rulesnone: only test files and their imports pick tests
impact.ignore**/*.md, **/*.mdx, **/*.txt, docs/**

The Impact page in the dashboard shows the same index.

Next

On this page

Run it on every pull request

A GitHub check and one comment per pull request, with the flight records attached.

Set up CI