Skip to content
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

test: use ava/get-port plugin instead of randomizing ports based on process id #4199

Open
erezrokah opened this issue Feb 7, 2022 · 0 comments

Comments

@erezrokah
Copy link
Contributor

erezrokah commented Feb 7, 2022

In the CLI tests we spawn multiple HTTP servers (directly and indirectly via CLI commands).
Since ava run specs in different processes we randomize port acquisition based on process id:

const startPort = Math.floor(rng() * RANDOM_PORT_SHIFT) + RANDOM_PORT_SHIFT

to avoid collisions.

With ava version 4 we can use https://github.com/avajs/get-port to ensure ports are safely acquired across test files.

Note this is blocked by a Node.js 16.13.2 bug (see avajs/ava#2947) as we had to disable worker threads which is required for ava/get-port to worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant