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

vi.stubEnv results in process not defined error #7386

Closed
6 tasks done
idleberg opened this issue Jan 30, 2025 · 1 comment
Closed
6 tasks done

vi.stubEnv results in process not defined error #7386

idleberg opened this issue Jan 30, 2025 · 1 comment

Comments

@idleberg
Copy link

Describe the bug

Whenever I call vi.stubEnv() in a test, it will fail with the error process is not defined. I created a MRE using create-vite with the React preset. The manifest is set to "type": "module", so I'm sure the method should even use process.env.

Reproduction

https://github.com/DerStandardAT/vitest-stubenv

System Info

System:
    OS: Linux 6.8 Ubuntu 24.04.1 LTS 24.04.1 LTS (Noble Numbat)
    CPU: (16) x64 12th Gen Intel(R) Core(TM) i7-1260P
    Memory: 15.00 GB / 30.96 GB
    Container: Yes
    Shell: 3.7.0 - /usr/bin/fish
  Binaries:
    Node: 22.13.0 - ~/.nvm/versions/node/v22.13.0/bin/node
    npm: 10.9.2 - ~/.nvm/versions/node/v22.13.0/bin/npm
    pnpm: 9.15.3 - ~/.nvm/versions/node/v22.13.0/bin/pnpm
    bun: 1.0.4 - ~/.bun/bin/bun
  Browsers:
    Chrome: 132.0.6834.159
  npmPackages:
    @vitejs/plugin-react: ^4.3.4 => 4.3.4 
    @vitest/browser: ^3.0.4 => 3.0.4 
    vite: ^6.0.5 => 6.0.11 
    vitest: ^3.0.4 => 3.0.4

Used Package Manager

pnpm

Validations

@hi-ogawa
Copy link
Contributor

This is not supported but it's planed as requested in #6667. I'm closing this in favor of the feature request.

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

2 participants