Improve miniflare test stability#11642
Merged
petebacondarwin merged 21 commits intomainfrom Dec 18, 2025
Merged
Conversation
🦋 Changeset detectedLatest commit: eb10e46 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
479b2bb to
f557e60
Compare
4134d07 to
688b106
Compare
create-cloudflare
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
wrangler
commit: |
41d5d16 to
574eab3
Compare
Contributor
|
Claude finished @petebacondarwin's task —— View job Changeset Review✅ All changesets look good The changeset
|
8e1ec64 to
8cad69f
Compare
ascorbic
approved these changes
Dec 18, 2025
Contributor
Author
|
Oops I forgot to remove the "blasting Windows" commit. |
cf04605 to
a198713
Compare
These tests will need to download the Chrome browser in the background, which can take quite a few seconds sometimes.
In particular the dev-registry tests appear to be particularly sensitive to concurrency issues, likely due to shared ports/sockets.
a198713 to
eb10e46
Compare
Merged
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.
The Miniflare unit tests flake fairly often on Windows (and occasionally on other OSes). The errors are a bit difficult to debug because Ava only renders "Fetch failed" and not the
causethat contains the actual useful info.Errors
The patch to the concordance library exposes the
causefor these errors, such as:Diagnosis
This can be caused by a race condition between Undici's Keep-Alive mechanism and the Miniflare/Workerd server.
Fix
The fix is to prevent Undici from trying to keep the connection alive.
Connection: closeheader to the request to force undici to use a new connection for each request. But this felt a bit invasive on the request (and also this header is disallowed for HTTP.reset: truewhich has the same effect of preventing Undici from trying to keep the connection alive. See docs here.Extras
In addition to the main fix, this PR also quietens/silences a lot of the other miniflare tests that were dumping unnecessary and distracting logs into the test output.
A picture of a cute animal (not mandatory, but encouraged)