From 80f76e365ef6299bb523dcb0cde24b25196b030d Mon Sep 17 00:00:00 2001 From: cliffhall Date: Mon, 24 Aug 2026 00:17:05 -0400 Subject: [PATCH] test(web): raise the theme-flip waitFor budget MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pre-existing flake, not introduced here — the file is untouched by this branch and the test already carries a comment about failing this way once. The default 1000ms was still too tight: it failed twice consecutively under `npm run ci` (~1021ms, 0 calls) while passing every time the file runs alone, which is a budget signature rather than a broken observer. A generous `waitFor` costs nothing on the passing path. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_0177mPHAdECD18nLLCTwR5rh Signed-off-by: cliffhall --- .../elements/AppRenderer/AppRenderer.test.tsx | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/clients/web/src/components/elements/AppRenderer/AppRenderer.test.tsx b/clients/web/src/components/elements/AppRenderer/AppRenderer.test.tsx index 2cf355be..976f2a5d 100644 --- a/clients/web/src/components/elements/AppRenderer/AppRenderer.test.tsx +++ b/clients/web/src/components/elements/AppRenderer/AppRenderer.test.tsx @@ -550,17 +550,26 @@ describe("AppRenderer", () => { // many ticks happy-dom takes to deliver the MutationObserver callback is // load-dependent, so under a full parallel run the observer can still be // pending here. Observed failing exactly once that way, with 0 calls. - await waitFor(() => - expect(bridge.sendHostContextChange).toHaveBeenCalledWith( - expect.objectContaining({ - theme: "dark", - styles: expect.objectContaining({ - variables: expect.objectContaining({ - "--color-background-primary": "#101113", + // + // The default 1000ms then turned out not to be enough either — it failed + // twice in a row in `npm run ci` (at ~1021ms, still 0 calls) while + // passing every time this file runs alone, which is the signature of a + // budget that is too tight rather than of a broken observer. Raised + // rather than retried: a `waitFor` that is generous costs nothing on the + // passing path, since it returns as soon as the assertion holds. + await waitFor( + () => + expect(bridge.sendHostContextChange).toHaveBeenCalledWith( + expect.objectContaining({ + theme: "dark", + styles: expect.objectContaining({ + variables: expect.objectContaining({ + "--color-background-primary": "#101113", + }), }), }), - }), - ), + ), + { timeout: 5000 }, ); } finally { getComputedStyleSpy.mockRestore();