Post-Edit Test Guard已精选
Hook-based loop that runs related tests after file edits to catch regressions early.
基本信息
分类
测试
目标
after each batch of file edits, related tests must pass before continuing.
检查命令
npm test -- --findRelatedTests <edited files>
退出条件
related tests exit 0.
支持的智能体
Cursor
启动提示词
Install and run the "Post-Edit Test Guard" loop.
Goal: after each batch of file edits, related tests must pass before continuing.
Between iterations run: npm test -- --findRelatedTests <edited files>
Exit when: related tests exit 0.
Step 1: After edits, run related tests. If they fail, fix before making more changes.步骤
- 1
Detect edited files
Identify which source files were edited in the last turn.
- 2
Run related tests
Run the smallest relevant test subset for edited files. Fix failures before continuing.
npm test -- --findRelatedTests
更多 测试 相关内容
Build Until Green
Run the production build, fix compile and bundling errors, and loop until the build succeeds.
Coverage Until Threshold
Add focused tests until coverage meets your threshold (e.g. 80%), without changing production behavior unnecessarily.
Format Until Clean
Run the formatter, fix any remaining style issues, and loop until the codebase formats cleanly with no diffs.
Flaky Test Triage
Run failing tests repeatedly, classify each failure as flaky or real, and fix only confirmed regressions.
Pre-Commit Guard
Hook that runs tests before git commit commands to block commits when the suite is red.
Autoloop TDD
Test-first loop: write a failing test, implement the minimum code to pass, refactor, and repeat.
评论