[FEATURE] Run only the tests affected by Claude's edits after each batch of edits
Status Open
Maintainer reply None cached
Activity 1 comment · opened Oct 11, 2026
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
After editing, Claude either runs the full test suite, which is slow and so often skipped, or guesses a single test file. Either way the feedback loop between "Claude changed code" and "we know it still works" is slow or missing.
Claude Code knows exactly which files were just changed. Most test runners can already select related tests from a list of files. Nothing connects the two.
Proposed Solution
A setting that runs a command at the end of a batch of edits, meaning when Claude finishes a group of consecutive edits rather than after every single file, with the changed files filled in:
"afterEdits": {
"command": "npx vitest related --run {files}",
"timeout": 120
}
- Presets for common runners:
jest --findRelatedTests,vitest related,pytest --testmon,go teston changed packages,cargo test. - Results go back to Claude as context: failures in full, and a single line when everything passed.
- Shown in a compact line in the UI:
✅ 14 related tests passed (3.2s). - Can be toggled per session, for example
/afteredits off.
Alternative Solutions
PostToolUsehooks on Edit/Write: these fire after each file, so a 6-file change runs the tests 6 times, mostly against half-finished code. There is no "batch finished" event to hook into.- Asking Claude to run related tests: depends on the model remembering, and choosing the right ones.
- IDE test watchers: they run, but Claude doesn't see the results.
Priority
Medium - Would be very helpful
Feature Category
Developer tools/SDK
Use Case Example
- Claude edits
auth/session.ts,auth/token.tsandapi/login.ts. - When the batch ends, Claude Code runs
vitest related --runwith those 3 files: 22 tests in 4 seconds. - One fails. Claude sees it right away and fixes it before reporting "done", instead of me finding out in CI.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗