vitest-dev / vitest-dev/vitest
Pick lower ephemeral port for browser mode
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 17.1k
- Forks
- 2k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 94
Description
Clear and concise description of the problem
When using browser mode, Vitest picks a port starting at 63315.
I've been observing failures with some users using "corporate" windows devices. I wasn't able to diagnose in detail but it seems that some security policies might prevent users from starting servers on high ranges.
IANA seems to recommend the following range 49152-65535 for ephemeral ports, hence the 63315, I guess.
Right now, I don't know if the whole range is blocked by such policies and if it would be more pragmatic to just use a port range <10000.
I am opening this issue to collect more feedback from the trenches.
Suggested solution
Pick ports in a lower range.
Alternative
The current workaround is to override the port manually in the configuration:
{
test: {
browser: {
api: 7357
}
}
}
Additional context
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files or tests are named. Start by locating the browser mode port selection and its configuration handling, then investigate a lower default range and the existing manual override. Done means browser mode uses a lower default port while explicit values such as 7357 continue to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- testing-qa
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100