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

Vitest workspaces not properly supported by defineVitestConfig #1043

Open
TheDutchCoder opened this issue Dec 18, 2024 · 1 comment
Open
Labels
bug Something isn't working

Comments

@TheDutchCoder
Copy link

Environment

------------------------------
- Operating System: Darwin
- Node Version:     v20.13.0
- Nuxt Version:     3.14.1592
- CLI Version:      3.16.0
- Nitro Version:    2.10.4
- Package Manager:  [email protected]
- Builder:          -
- User Config:      default
- Runtime Modules:  @nuxt/[email protected], [email protected], @nuxtjs/[email protected], [email protected], @nuxtjs/[email protected], @nuxtjs/[email protected], @vueuse/[email protected], @sidebase/[email protected], @vesp/[email protected]
- Build Modules:    -
------------------------------

Reproduction

When using a vitest workspace, vitest complains that it can't resolve the config files, this is due to defineVitestConfig.

> vitest

failed to load config from /Users/reinierkaper/rvezy/rvezy-web-client/src/tests/unit/vitest.config.ts

Describe the bug

I think the defineVitestConfig wrapper conflicts with what vitest expects back in a workspace configuration file.
Everything works fine when the tests are ran directly with a config file reference, just not in a workspace.

Additional context

No response

Logs

@gaisinskii
Copy link

I was going to raise a similar issue, but since this one exists I will ask my question here.

TLDR:

  1. Open https://stackblitz.com/~/github.com/gaisinskii/nuxt-split-tests-issue
  2. Wait for deps installation
  3. Run pnpm run test:unit or pnpm run test:e2e
  4. Console says No test files found. You can change the file name pattern by pressing "p"

The issue:

My colleagues and I want to separate unit & e2e tests and from what I understand the only way of doing it is to use vitest workspaces. I've tried different configurations and the only way it worked was to replace defineVitestConfig with plain defineConfig.

@danielroe danielroe added bug Something isn't working and removed pending triage labels Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants