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

Support Vitest Browser Mode w/ Playwright provider #1106

Open
JessicaSachs opened this issue Jan 29, 2025 · 2 comments
Open

Support Vitest Browser Mode w/ Playwright provider #1106

JessicaSachs opened this issue Jan 29, 2025 · 2 comments

Comments

@JessicaSachs
Copy link

JessicaSachs commented Jan 29, 2025

Environment

  • Operating System: Darwin
  • Node Version: v22.9.0
  • Nuxt Version: 3.15.4
  • CLI Version: 3.21.1
  • Nitro Version: 2.10.4
  • Package Manager: pnpm@9.6.0
  • Builder: -
  • User Config: compatibilityDate, devtools
  • Runtime Modules: -
  • Build Modules: -

Reproduction

https://github.com/JessicaSachs/nuxt-playwright-vitest-browser-repro

Describe the bug

Vitest completely hangs when I try to launch it with pnpm vitest

Image

There's an error in the Vitest browser UI which is swallowed by the CLI

❯ /node_modules/.pnpm/vite@6.0.11_@types+node@22.12.0_jiti@2.4.2_terser@5.37.0_yaml@2.7.0/node_modules/vite/dist/client/env.mjs:12:482

Image

Additional context

After following the instructions, pulling the reproduction repo, and otherwise trying to get a basic installation of Vitest + Playwright + Nuxt working, I've found that I can't.

Logs

@JessicaSachs
Copy link
Author

JessicaSachs commented Jan 30, 2025

The documentation around Browser Testing is super confusing. I finally figured out that Nuxt supports Playwright via Vitest but ONLY in the Node context and that it's a complete replacement for Vitest's own Playwright stuff.

The Nuxt documentation as written is NOT supposed to be used with Vitest's Playwright as Vitest documents it and that they're completely unrelated aside from Vitest being the test runner.

😭

I was so confused about which page I was dealing with and the interoperability between Vitests Page API and Nuxt's Page API. It was mainly the TypeScript and expect types that were throwing me off.

I expected Vitest's expect to have been extended with DOM matchers and it wasn't. Now I understand why.

This issue is still applicable because I still want to render my Nuxt app in Vitest browser mode, but I am a little less confused about the purpose of @nuxt/test-utils/e2e.

@Archetipo95
Copy link

@danielroe sorry for tagging you directly but I think that you can help us here. As @JessicaSachs mentioned, there is A LOT of confusion around tests in nuxt/vitetest/vue/playwright...

I think that the current documentations needs to be more clear, maybe we need more examples? More use cases? I don't know but I want to start a discussion around this and improve the DX for others.

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