Fix Failing Tests
Runs your test suite and fixes failing tests one file at a time until the suite is green.
Anyone who just had an AI rewrite a chunk of code and now has a red test suite with a dozen failures.
The problem
A full test run fails in several files at once. You read the first failure, fix it, rerun everything, and wait again to see what is still broken. Doing this in a loop by hand wastes time on the parts of the suite that already pass.
1. Work list
The command that lists every item. No AI involved.
npx vitest run --reporter=json 2>/dev/null | jq -r '.testResults[] | select(.status=="failed") | .name'2. Unit of work
One item is one test file that has at least one failing test.
3. The check
The checker runs npx vitest run <file>. Exit code 0 means every test in that file passed. Exit code 1 means at least one still fails, and the checker prints the failing assertion and the diff back to the AI.
4. Stopping rule
Each test file gets up to 3 fix attempts, then goes to quarantine, and the loop ends when the work list is empty.
What this cannot catch
A passing test only proves the assertions inside it are met. If the test itself is weak, this loop can leave wrong behavior in place and call it done.
Build it
Install justloopit, then describe this task in your AI coding tool. It will ask about your project, then write the checker, the runner, and the spec.