Commit b551b9d
fix(CDPBrowser): deterministic Obscura suite — await within-block promise chains in shared webapi tests; null-safe assertion message templating
Flake 1 ("should respect form fields inside within block") and Flake 2 (the
"kills a SIGTERM-ignoring child within bounds" phantom) were one bug, not two.
test/helper/webapi.js's `within tests` fired `I._withinBegin(locator).then()...`
without awaiting/returning it, racing the test's own later `await`ed
assertions against the still-in-flight async scope setup. Under load this
produced a real AssertionFailedError with a `null` param. lib/utils.js's
template() only guarded `undefined`, so formatting that error inside Mocha's
own epilogue threw `null.toString()`, crashing the reporter mid-print; Mocha's
uncaughtException recovery then misattributed the crash to whatever test was
`currentRunnable` (the last-run spawn-lifecycle test), producing a blank,
EXIT:0 "phantom" failure on an otherwise fully deterministic test (verified
15/15 clean in isolation).
Fixes:
- test/helper/webapi.js: await the three unawaited within-block promise
chains that precede further awaited assertions in the same test body.
- lib/utils.js: template() now treats `null` the same as `undefined`
(renders as empty string instead of throwing) — a deliberate divergence
from 3.x, which has the identical latent bug.
Verified via 3 consecutive full Obscura suite runs (179 passing/122
pending/0 failing, exit 0 each time, instrumented to confirm zero unhandled
rejections escalate to a Mocha failure), isolated within-describe passes on
Obscura/Chrome/Puppeteer/Playwright, and a clean Chrome regression run
(201/112/0, unchanged). Full root-cause writeup in
.superpowers/flake-report.md.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>1 parent db172f4 commit b551b9d
2 files changed
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
| 111 | + | |
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1620 | 1620 | | |
1621 | 1621 | | |
1622 | 1622 | | |
1623 | | - | |
| 1623 | + | |
1624 | 1624 | | |
1625 | 1625 | | |
1626 | 1626 | | |
| |||
1638 | 1638 | | |
1639 | 1639 | | |
1640 | 1640 | | |
1641 | | - | |
| 1641 | + | |
1642 | 1642 | | |
1643 | 1643 | | |
1644 | 1644 | | |
| |||
1661 | 1661 | | |
1662 | 1662 | | |
1663 | 1663 | | |
1664 | | - | |
| 1664 | + | |
1665 | 1665 | | |
1666 | 1666 | | |
1667 | 1667 | | |
| |||
0 commit comments