Repository navigation
test: fix Windows flakes in cli standalone, Storybook and snapshot tests - #56181
Merged
Merged
Conversation
neriousy
force-pushed
the
windows-test-flakes
branch
from
October 16, 2026 16:13
511b775 to
004278d
Compare
neriousy
marked this pull request as ready for review
October 16, 2026 16:13
Contributor
There was a problem hiding this comment.
I found no blocking concerns.
To check the Storybook fix, I ran Storybook's string-stripping regex under Node 24 on both versions of main.ts. The old file was still running when I killed it after 20s; the reworded one took 0 ms. With this PR, bun run storybook starts under Node and serves the page. The core snapshot test passes and type checks are clean in cli and core. The standalone test fails the same way on base and on this branch in my Linux sandbox, so I couldn't confirm the Windows EBUSY fix here.
The public API is unchanged; only tests and Storybook config are touched.
This was referenced Oct 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
No issue. Found by reviewing every Windows
unitande2efailure ondevpushes and PRs since #55866 merged.Type of change
What does this PR do?
Fixes or diagnoses the Windows flakes that recur across unrelated PRs and are not covered by an open PR. #55559 (service registration
EPERM), #55988 (gui-extensionsworker rpc) and #55881 (mobile timeline e2e) cover the others.Storybook server crash (
e2e (windows, app-components)). Two of the three recent Windows component failures (onfocus-ringsandfix-worker-rpc-flake) were Storybook dying mid-run, after which 97 and 109 tests failed withERR_CONNECTION_REFUSED:This is oven-sh/bun#40350: Bun's
node:httpthrows an uncaught "write after end" when a browser abandons pipelined requests, which kills the server. It is fixed in Bun 1.4.3 (oven-sh/bun#43557), but the repo pins 1.4.2. The Playwright web server ran Storybook withbun --bun; it now runs on Node, which Storybook targets (CI already installs Node 24.15 for these jobs). The app e2e suite is unaffected: its static server usesBun.serve, notnode:http.Storybook on Node first hung at startup (100% CPU after the banner). Storybook checks
main.tsfor CommonJS withstripCommentsAndStrings, which removes string literals before comments using/(['"])(?:\.|(?!\1)[\s\S])*?\1/g. The apostrophe in amain.tscomment ("Storybook's optimizer plugin", added in #55866) opened a string that never closes, and the regex then backtracks exponentially over the backslashes later in the file: about 0.5s on Bun's JavaScriptCore, effectively forever on V8. The comment is reworded, with a note to keep apostrophes out ofmain.tscomments. The function is unchanged on Storybook'snext` branch (it came in with storybookjs/storybook#33572).standalone server exits when its owner is killed(cli). Failed on a dev push withEBUSYfromfs.rmon its temp directory, after every assertion had passed: Windows briefly keeps the exited server's files locked. The test now uses core'stmpdirfixture, which retries removal onEBUSY. Bun'sfs.rmdoes not implementmaxRetries(it is parsed only in a test-only validator), so themaxRetries: 20inpackages/cli/test/acp/subprocess.tsmost likely does nothing.Snapshot > captures concurrently from independent processes(core). Failed on Windows on #55866's dev push and onpack-libraries: acapture()returnedundefined.capture()reports failures only throughEffect.logWarning, and the test harness'sTestConsoleswallows that output, so the cause never reached the log. The test now collects warnings and prints them as the assertion message, so the next failure shows its cause. I could not reproduce it: a temporary commit ran the test 40 times on Windows CI (run) and all 40 passed, against 2 failures in roughly 30 Windows core runs since #55866. A fix should follow the first logged cause rather than a guess.How did you verify your code works?
bun test test/standalone.test.tsinpackages/cli: passes.bun run script/test.ts test/snapshot.test.ts --rerun-each 10inpackages/core: 110/110. I also checked that the logger receives thefailed to capture snapshotwarning with its full cause chain by forcing a capture failure in a scratch test.Storybook on Node (process tree shows
node .../storybook dev),CI=true, locally on macOS:bun --cwd packages/session-ui test:components: 141 passed.bun --cwd packages/app test:components: 117 passed, 3 failed, 1 flaky. The same 3 tests (browser-pane-restore.spec.ts:123and the twomobile variant drawerdismiss tests) also fail on this machine with the oldbun --buncommand, so they are local to my setup; they pass in CI.bun typecheckinpackages/coreandpackages/cli: clean.Windows CI on this branch:
unit (windows)passed, including the 40 repeats above;e2e (windows, app-components)121/121 ande2e (windows, session-ui-components)141/141 with Storybook on Node, nothing flaky.Screenshots / recordings
N/A
Checklist