Skip to content

Prevent timed-out preload setup from contaminating desktop tests - #2351

Merged
ymichael merged 1 commit into
mainfrom
bb/ci-flake-fix-desktop-preload-import-timeout-cont-thr_teg7bzhy4s
Aug 24, 2026
Merged

ymichael merged 1 commit into
mainfrom
bb/ci-flake-fix-desktop-preload-import-timeout-cont-thr_teg7bzhy4s

Conversation

@ymichael

Copy link
Copy Markdown
Collaborator

What was wrong

preload-browser-api.test.ts reset Vitest's module registry and dynamically imported the preload inside every test body. Under contention, that import crossed the first test's 10-second timeout. Vitest reported the timeout but did not cancel the pending async body, so it resumed later and appended its 14 IPC sends to the shared electronMock after the following zoom test had reset it. That produced the observed 16 calls instead of 2. The failing packages job and the successful same-SHA rerun show this is timing-dependent rather than a regression from PR #2346.

What changed

Moved the per-test preload reset/import into a beforeEach hook with a setup-specific 30-second timeout. Test command bodies now begin only after preload setup completes, so a slow transform cannot release stale commands into a later test. Module state is still reset for every test, and all production behavior and assertions are unchanged.

How you verified

  • Reproduced the exact failure on merge-base with a temporary Vitest transform that delayed preload.ts by 10.5 seconds: the first test timed out at 10 seconds and the next test received 16 sends.
  • Re-ran the same delayed transform after the change: all 5 tests passed in 10.92 seconds.
  • pnpm exec vitest run --config vitest.config.ts test/preload-browser-api.test.ts — 5 tests passed.
  • pnpm exec turbo run test typecheck build lint --filter=@bb/desktop --force — 15/15 Turbo tasks passed; desktop test suite 35 files / 230 tests passed.

AGENT GENERATED: by GPT-5.6-Sol

@ymichael
ymichael merged commit f124986 into main Aug 24, 2026
15 checks passed
@ymichael
ymichael deleted the bb/ci-flake-fix-desktop-preload-import-timeout-cont-thr_teg7bzhy4s branch August 24, 2026 22:48
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.

1 participant