Run Tests and Fix Failures
Run the project's test suite and fix any failing tests.
Steps
-
Detect test command:
- Check
package.jsonforscripts.test(JS/TS projects) - Check for
Cargo.toml→cargo test - Check for
go.mod→go test ./... - Check for
pyproject.tomlorpytest.ini→pytest - Check for
mix.exs→mix test
- Check
-
Detect package manager (for JS/TS):
bun.lock→bun run testpnpm-lock.yaml→pnpm run testpackage-lock.json→npm run testyarn.lock→yarn run test
-
Run the test suite
-
If tests fail:
- Analyze the failure output
- Read the failing test file(s)
- Understand what the test expects
- Fix the code (not the test) unless the test itself is wrong
- Re-run tests to verify fix
- Repeat until all tests pass
-
Report results:
- Number of tests run
- What was fixed (if anything)
- Final pass/fail status
Rules
- Never disable or skip tests to make them pass
- Fix the underlying code, not the test (unless test is clearly wrong)
- If a test seems wrong, ask before modifying it