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

Unable to use with Vitest in browser mode #984

Open
lavoscore opened this issue Oct 18, 2024 · 1 comment
Open

Unable to use with Vitest in browser mode #984

lavoscore opened this issue Oct 18, 2024 · 1 comment

Comments

@lavoscore
Copy link

Environment

  • Operating System: Linux
  • Node Version: v18.20.3
  • Nuxt Version: 3.13.2
  • CLI Version: 3.14.0
  • Nitro Version: 2.9.7
  • Package Manager: [email protected]
  • Builder: -
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Reproduction

https://stackblitz.com/edit/github-912ubv

run pnpm test:browser and check the components directory for Foo.vue and Foo.test.ts

Describe the bug

I'm following steps 1 and 2 from the setup, but when running vitest in browser mode I get the following error in the browser UI:

ReferenceError: process is not defined
❯ /node_modules/.pnpm/vite@5.4.8_@types[email protected][email protected]/node_modules/vite/dist/client/env.mjs:12:519

Could that be because process is in fact referenced inside https://github.com/nuxt/test-utils/blob/main/src/config.ts, when I'm running the test runner under a browser environment, and not in Node? If so, how can I configure vitest to run in browser mode under Nuxt environment?

Additional context

No response

Logs

No response

@halkony
Copy link

halkony commented Oct 24, 2024

Can confirm that I am getting the same error.
Nuxt: 3.13.0
Vitest + @vitest/browser: 2.1.3

I tried several different package versions with no luck. Error shows up on both, WebdriverIO and playwright, firefox and chrome. Sometimes the error doesn't pop up though.

Either way, test discovery does not populate in browser mode.

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