fix(report)!: count interrupted tests apart from failures

Merged
OK
2mo ago
+519-100

Interrupted tests were counted as failed in every output. Ctrl-C at 4s on the testbed printed 3 failed, summary.md said 🔴 e2e: 3 failed with 3 failure pages, and report.json had summary.failed: 3, all 3 of them interrupted. The report wire format freezes with the first stable release, so the count has to land now.

  • report.json: run.summary gains interrupted. failed counts failed and timed out only (packages/e2e/src/report/build.ts, computeSummary). Schema, both fixtures, and a schema test change with it.
  • run.summary.skipped counted the tests the selection left out (--grep todo: skipped: 62 while the list said 7 passed (7)). It now counts selected results only, so passed + failed + interrupted + flaky + skipped = selected, and the left-out tests are discovered - selected.
  • statusBucket in packages/e2e/src/report/format.ts has an interrupted bucket, so every reporter counts it on its own:
    • list: 3 interrupted in yellow in Test Files and Tests and on the file line. Interrupted tests are left out of Failed Tests.
    • markdown: the âšī¸ glyph, no failure block and no page under failures/. The headline is âšī¸ when the run was interrupted with no real failure, and 🔴 otherwise.
    • junit: <skipped message="interrupted: ...">, not <error>. JUnit has no interrupted outcome, and the test reached no verdict.
    • @e2e-dev/github: the --last-failed fold counts interrupted. A test that was interrupted and then passed reads as passed, not flaky. A test that failed and whose rerun was interrupted stays failed.
    • Telemetry gains tests_interrupted.
  • Forced interrupt (two SIGINTs, which is what a GitHub Actions cancel sends as SIGINT then SIGTERM): runReporters abandoned every reporter, including the built-in junit and markdown. That left the previous run's summary.md and junit.xml, possibly green, beside the new report.json. Those two are no longer abandoned on force; the timeout still bounds them. Custom reporters are still abandoned (packages/e2e/src/run/runner.ts, FILE_REPORTERS).
  • A test that failed and whose retry an interrupt cut short stays failed (runWithRetries in packages/e2e/src/run/retry.ts), and every reporter tells the failed attempt, not the interrupted one. A serial group member keeps the verdict of the attempt before the interrupted retry (packages/e2e/src/run/serial.ts).
  • --repeat-each: a repeat the interrupt stopped or never started is listed as interrupted, not as a flake (packages/e2e/src/report/repeats.ts).
  • The markdown headline shows âšī¸ whenever it lists an interrupted test with no failure, so a passing --last-failed rerun that carries a never-finished test does not read green.
  • Exit codes are unchanged: 130 for an interrupt, 1 for --max-failures.
  • Docs: reference/cli.mdx (summary counts, junit and markdown rows, signals), reference/reporters.mdx, ci.mdx, github.mdx, telemetry.mdx, and skills/e2e/references/running.md.

Verified

Ran it locally: yes

  • Testbed, built CLI, e2e run --workers 8 --reporter list,markdown,junit, sent SIGINT after 4s. Also --workers 64 with SIGINT after 3s, --config e2e.stress.config.ts --max-failures 2 --workers 4, --grep todo, and a forced run: a green tests/smoke.e2e.ts run first, then the full run with two SIGINTs 20ms apart. Each was run on origin/main and on this branch.

SIGINT at 4s, --workers 8:

mainthis branch
listTests 4 failed | 48 passed | 19 skipped (71)Tests 3 interrupted | 51 passed | 17 skipped (71)
report.json summaryfailed: 4, all 4 results interruptedfailed: 0, interrupted: 3
summary.md### 🔴 e2e: 4 failed, 48 passed, 19 skipped### âšī¸ e2e: 3 interrupted, 51 passed, 17 skipped
failures/4 pagesnone
junit.xmlfailures="0" errors="4" skipped="19"failures="0" errors="0" skipped="20", each <skipped message="interrupted: run interrupted in phase body"/>

--max-failures 2 --workers 4 on the stress suite (2 real failures, 3 cut short):

mainthis branch
listTests 5 failed | 4 passed | 6 skipped (15)Tests 2 failed | 3 interrupted | 4 passed | 6 skipped (15)
summary.md### 🔴 e2e: 5 failed, 4 passed, 6 skipped, 5 pages### 🔴 e2e: 2 failed, 3 interrupted, 4 passed, 6 skipped, 2 pages
exit11

--grep todo:

mainthis branch
report.json summaryselected: 7, passed: 7, skipped: 62selected: 7, passed: 7, skipped: 0 (discovered 69)

Forced interrupt after a green run:

mainthis branch
stderrreporter "markdown" abandoned: the run was forced to stop, same for junitnothing
summary.mdstale: ### đŸŸĸ e2e: 3 passed, 1 skippedfresh: ### âšī¸ e2e: 3 interrupted, 51 passed, 17 skipped
junit.xmlstale: tests="4"fresh: tests="71"

Branch list output from the SIGINT run:

interrupted: stopping the running test and tearing down (interrupt again to force)
 ❯  web  tests/controls.e2e.ts (15 tests | 1 interrupted | 11 skipped) 2.69s
   × controls > enabled state arrives late and every read agrees (interrupted) 180ms
   ↓ controls > check and uncheck move checked state, and one radio checks at a time [run interrupted before execution]
...
 Test Files  3 interrupted | 11 passed (14)
      Tests  3 interrupted | 51 passed | 17 skipped (71)

Failed first attempt, retry interrupted (--retries 1, SIGINT at 5s, a scratch test not committed): branch reports failed: 1, interrupted: 0, ### 🔴 e2e: 1 failed with the first attempt fails block, junit <failure message="first attempt fails" type="ERROR">, exit 130.

New integration test a forced interrupt still writes the junit and markdown files (runner-lifecycle.test.ts) fails with the runner fix reverted: expected '### đŸŸĸ e2e: 3 passed\n'.