-
Notifications
You must be signed in to change notification settings - Fork 669
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: wait for actual port before opening browser with --port=0
#5033
Conversation
🦋 Changeset detectedLatest commit: 00147c8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
A wrangler prerelease is available for testing. You can install this latest build in your project with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/7933801579/npm-package-wrangler-5033 You can reference the automatically updated head of this PR with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/5033/npm-package-wrangler-5033 Or you can use npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/7933801579/npm-package-wrangler-5033 dev path/to/script.js Additional artifacts:npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/7933801579/npm-package-create-cloudflare-5033 --no-auto-update npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/7933801579/npm-package-cloudflare-kv-asset-handler-5033 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/7933801579/npm-package-miniflare-5033 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/7933801579/npm-package-cloudflare-pages-shared-5033 Note that these links will no longer work once the GitHub Actions artifact expires.
Please ensure constraints are pinned, and |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5033 +/- ##
==========================================
- Coverage 70.42% 70.37% -0.05%
==========================================
Files 297 297
Lines 15425 15458 +33
Branches 3952 3966 +14
==========================================
+ Hits 10863 10879 +16
- Misses 4562 4579 +17 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pulled this down and tested locally, given that we don't have any tests for user interactions in wrangler dev
.
The only thing I would note is that we are not told that Wrangler is waiting for the port to become available. |
Fixed in 0147c8, |
Fixes part of #3907.
What this PR solves / how to test:
When running
wrangler dev --port=0
, Wrangler doesn't know the port the dev server started up on until theonReady
callback is called. In--remote
mode, this can take a while meaning there's a significant period of time where pressing b openslocalhost:0
. This change ensures we wait until the firstonReady
call before opening the browser with the correct port.Author has addressed the following:
interactive-dev-tests
. But the behaviour is only observable when using--remote
mode which requires Cloudflare account credentials. We could write a unit test for this, but again this is tricky becauseuseHotkeys()
relies on theuseInput()
hook from Ink, which we'd need to mock. This behaviour also relies on module-level variables. 😬Note for PR author:
We want to celebrate and highlight awesome PR review! If you think this PR received a particularly high-caliber review, please assign it the label
highlight pr review
so future reviewers can take inspiration and learn from it.