← Back to Dashboard
#8718 vitest-pool-workers process.env is not populated
Recommendation:KEEP OPEN
Difficulty:easy
Reasoning:
Root cause identified; fix agreed upon but not implemented
Suggested Action:
Set keepProcessEnv: true by default
Analysis Report
Issue Review: cloudflare/workers-sdk#8718
Summary
process.env is not populated when running tests with vitest-pool-workers, despite working in wrangler dev and deploy.
Findings
- Created: 2025-03-29
- Updated: 2025-10-30
- Version: @cloudflare/vitest-pool-workers 0.7.5 → current
- Component: vitest-pool-workers
- Labels: bug, vitest
- Comments: 7
Key Evidence
- Reproduction repo: https://github.com/threepointone/repro-vitest-pool-process-env
- Root cause identified: Vite statically replaces
process.envwith empty object - Workaround:
import process from 'node:process'or setkeepProcessEnvin ssr environment - Maintainers agreed to set
keepProcessEnv: trueby default for ssr environment - @dario-piotrowicz filed Vite bug for inheritance issue
- No PR found that implements the agreed-upon fix
Recommendation
Status: KEEP OPEN
Reasoning: The root cause is identified and maintainers agreed on a solution (set keepProcessEnv: true by default), but no PR implementing this fix has been merged. The workaround exists but the default behavior should be fixed.
Action: Implement the agreed-upon fix: set keepProcessEnv: true by default in vitest-pool-workers for the ssr environment.
Suggested Comment
N/A - Maintainers are aware and agreed on solution.
Notes & Feedback (0)
No notes yet.