test(api): use random ports for getFreePort e2e tests#179
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the Server.getFreePort e2e tests to avoid a fixed port range by introducing a random-port helper and switching the assertions to use per-run reserved ports, reducing CI flakiness due to port collisions.
Changes:
- Added
tests/helpers/get-random-port.jsto pick random (and sequential) ports for tests. - Updated
tests/e2e/api.test.jsServer.getFreePortcoverage to use randomly selected base/busy ports instead of the fixed60000+range.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| tests/helpers/get-random-port.js | New helper to find “random” available ports and contiguous port blocks for tests. |
| tests/e2e/api.test.js | Switches Server.getFreePort e2e cases to use reserved random ports and updates expectations accordingly. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4de6d50eb1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Summary
This PR updates the
Server.getFreePorte2e coverage to use random ports instead of a fixed60000range. It adds a small test helper for reserving random ports and keeps the assertions on retry behavior while removing a CI hotspot that could collide with other processes.Verified with targeted
rstestruns for theServer.getFreePortcases.Related Links
None