Skip to content

Browser runner: stall-based timeout, phase-aware page errors, afterEach on failure (0.2.19) - #26

Open
brainkim wants to merge 1 commit into
mainfrom
fix-firefox-browser-runs
Open

Browser runner: stall-based timeout, phase-aware page errors, afterEach on failure (0.2.19)#26
brainkim wants to merge 1 commit into
mainfrom
fix-firefox-browser-runs

Conversation

@brainkim

Copy link
Copy Markdown
Member

Fixes #25 and both firefox problems reported by the crank session against 0.2.18 (crank PR bikeshaving/crank#375). Verified against crank's real suite — 30 files, 602 tests — cloned into a scratchpad.

Stall-based browser timeout

--timeout is per-file on node/bun, but the browser ran the entire suite under one absolute deadline — 30 files (plus ~8s of firefox launch, measured) in a single file's allowance. Large suites "timed out" at the default while making steady progress. The wait loop now resets on progress (entry ready flag, runner start, each completed test); timeout ms of no progress is a genuine hang. Diagnostic dead end worth recording: the 1.6MB bundle parses in <600ms and inline-vs-external <script> makes no difference — startup cost is launch, not parse.

Phase-aware page errors

0.2.17 failed the run on any pageerror — but browsers disagree on what reaches it (firefox surfaces unhandled rejections there; chromium/webkit don't), so crank's intentional error-propagation rejections failed firefox only, with a message its registration counts disproved (all 602 tests ran). Uncaught errors are now captured in the page, where phase is known synchronously:

  • before the runner starts → registration cut short → red
  • during the run (module bodies complete, by the ESM ready-flag guarantee) → yellow warning, identical on all three browsers

A load-phase throw also now fails in ~5s naming the error, instead of waiting out the full timeout in silence.

afterEach runs for failing tests (#25)

Cleanup hooks moved out of the try: they run in all cases, each individually guarded, the test's own error kept as the reported failure — matching node:test/bun:test. Previously one real failure left a console.error stub installed and crank's webkit run reported 23 failures for 1 bug.

Verification

  • crank on firefox at the default timeout: 602 passed, 0 failed, 3 skipped + 3 warnings (was: timeout at 60s, or 3 spurious failures at 120s)
  • Sinon-cascade shape e2e (stub in beforeEach, restore in afterEach, one failing test): 3 passed, 1 failed — no cascade
  • crash-during-load: red in ~5s, named (was 60s of silence); late-registration and skip/TLA gauntlets unchanged
  • test-runner + esbuild-recovery files: 52/0. Full suite run pending — the machine is under a load-20 VM at the moment; will confirm before merge.

🤖 Generated with Claude Code

https://claude.ai/code/session_01QAc3iDuBb3zN41HrepErUw

…on failure

Three browser-runner fixes from crank PR #375's firefox/webkit runs
(coordinated with the crank session; verified against its real 602-test
suite):

- The browser timeout was one absolute deadline for the whole suite,
  while node/bun get `--timeout` per file - large suites "timed out" at
  the default while making steady progress (firefox launch alone is
  ~8s; the 1.6MB bundle parses in <600ms, measured, so it was never
  parse cost). The wait loop now resets on progress (ready flag, runner
  start, each completed test); `timeout` ms of NO progress is a hang.
- Page errors are captured in-page with the phase known synchronously:
  pre-start errors mean registration was cut short (red); mid-run
  unhandled rejections are warnings (crank intentionally floats them to
  test error propagation, and its registration counts proved nothing
  was lost). Also unifies behavior across browsers - firefox routes
  unhandled rejections to Playwright's pageerror, chromium/webkit
  don't.
- A load-phase throw fails in seconds naming the error instead of
  waiting out the full timeout in silence.
- afterEach runs for failing tests too (#25), each hook individually
  guarded, test's own error kept - one real failure previously left a
  stub installed and cascaded into 23 reported failures on webkit.

crank on firefox, default timeout: 602 passed, 0 failed, 3 skipped,
with the 3 intentional rejections as warnings.

Fixes #25

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

browser runner: a failing test skips its own afterEach, cascading one failure into many

1 participant