process.env.VITEST_WORKER_ID can be larger than maxThreads
See original GitHub issueDescribe the bug
We are migrating our Jest test code over to vitest. We use process.env.JEST_WORKER_ID
to allocate a separate database for each worker/thread. With Jest that JEST_WORKER_ID
is always between 1 and the maximum number of workers.
In vitest process.env.VITEST_WORKER_ID
seems to have another meaning and is ever increasing. The documentation states that VITEST_WORKER_ID
can be used to distinguish between threads. In my opinion this is not what it actually does.
Reproduction
Run any test-sutie and see that VITEST_WORKER_ID
increases. In watch-mode it increases with each run.
System Info
System:
OS: macOS 12.4
CPU: (10) arm64 Apple M1 Max
Memory: 1.36 GB / 64.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.13.1 - ~/.nvm/versions/node/v16.13.1/bin/node
Yarn: 3.1.0 - ~/.nvm/versions/node/v16.13.1/bin/yarn
npm: 8.10.0 - ~/.nvm/versions/node/v16.13.1/bin/npm
Browsers:
Chrome: 102.0.5005.115
Firefox: 100.0.2
Safari: 15.5
npmPackages:
vitest: 0.14.2 => 0.14.2
Used Package Manager
yarn
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn’t already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Issue Analytics
- State:
- Created a year ago
- Comments:13 (7 by maintainers)
Top Results From Across the Web
Tomcat - maxThreads vs. maxConnections - Stack Overflow
Tomcat can work in 2 modes: BIO – blocking I/O (one thread per connection); NIO – non-blocking I/O (many more connections than threads)....
Read more >Env Variables and Modes - Vite
Vite exposes env variables on the special import.meta.env object. ... An env file for a specific mode (e.g. .env.production ) will take higher...
Read more >Working with Environment Variables in Node.js - Twilio
First things first, we need to ensure that we have a Node.js environment. We'll then take you through the basics of setting up...
Read more >process.env: What it is and why/when/how to use it effectively
The process.env global variable is injected by the Node at runtime ... Ultimately, if an application is not deployed, no one can use...
Read more >Node Environment Variables: Process env Node
Node environment variables are strategies to define and consume environment-specific configurations and process env node. Learn how.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yes, it is!
Wow, that was quick! It’s ok for me that it may change. Thank you!