Skip to content

Unable to use with Vitest in browser mode #984

Open
@lavoscore

Description

@lavoscore

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions