Back to loops
Testingmanual

Test Until Green

Run your test suite, fix the smallest root cause on failure, and repeat until every test passes.

0 views0 usesby solo lemon.

// parameters

Triggermanual
Max iterations10
Check commandnpm test
Exit conditionAll tests pass (exit code 0)

// run_this_loop

Copy the kickoff into your agent first. The blueprint below explains how the loop evaluates progress and when it should stop.

Open in CursorOpen in Claude

Use loop copies the kickoff prompt. Share copies the loop link. Open in Cursor / Claude only pre-fill that prompt — they do not install hook files. Download loop saves the loop as test-until-green.md.

Start the "Test Until Green" loop.

Goal: all tests pass
Max iterations: 10
Between iterations run: npm test
Exit when: tests exit 0

Step 1: Run tests. If there are failures, fix the smallest root cause, then repeat.

Self-pace this loop. After each iteration, run the check command, read the output, and only continue if the exit condition is not met. Stop when the exit condition passes or max iterations is reached. Give a short status update each pass.

// blueprint

The loop contract: target outcome, execution sequence, checks, stopping condition, and safety constraints.

Goal

all tests pass

// loop_sequence

// loop_sequence_diagram.json
closed loop

Trigger

Manual start

Actions block

3 steps
1Run tests
2Fix failures
3Re-run tests

Feedback gate

Evaluate: npm test

Run the check, read the output, then decide whether the loop is complete.

Check failed

Repeat actions with the latest feedback.

Success

All tests pass (exit code 0)

Safety capMax 10 iterations

// steps

  1. 1
    Run tests

    Run the project test command and capture failures.

    npm test
  2. 2
    Fix failures

    Fix the smallest root cause for the current failing tests. Prefer minimal diffs.

  3. 3
    Re-run tests

    Run tests again and verify progress toward zero failures.

    npm test

Guardrails

Hardened
  • Do not modify the check command or exit criteria to force success
  • Do not skip, disable, or bypass checks to pass the exit condition
  • If stuck after several iterations, stop and report blockers instead of gaming metrics
  • Do not weaken, delete, or skip tests to make the suite pass
  • Do not replace real assertions with trivial always-pass tests
  • Prefer fixing production code over patching tests to go green