You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since upgrading to version 0.34.1, vi.stubEnv fails to alter the process.env.NODE_ENV variable.
For example:
// process.env.NODE_ENV = "test"test("should fail",()=>{vi.stubEnv("NODE_ENV","production")// This fails as it returns "test"expect(process.env.NODE_ENV).toBe("production")})
The issue does not persist if I downgrade to 0.33.0.
The latest version also breaks whenever I try to mutate process.env.NODE_ENV directly:
The whole test runner fails with the following error:
Error: Parse failure: Assigning to rvalue (15:4)
At file: /Users/USER/workspace/experiments/vitest-stubenv-bug/app/tests/entry.client.test.tsx
Contents of line 15: "test" = "production";
Describe the bug
Since upgrading to version
0.34.1
,vi.stubEnv
fails to alter theprocess.env.NODE_ENV
variable.For example:
The issue does not persist if I downgrade to
0.33.0
.The latest version also breaks whenever I try to mutate
process.env.NODE_ENV
directly:The whole test runner fails with the following error:
Reproduction
I've set up a repo to reproduce my issue in the same stack as the application I'm facing problems with (Remix, Cloudflare pages):
https://github.com/jordykoppen/vitest-stubenv-bug
I've included test cases for both issues.
System Info
Used Package Manager
pnpm
Validations
The text was updated successfully, but these errors were encountered: