nuxt/test-utils

`defineVitestConfig` from `@nuxt/test-utils` is not a drop-in replacement for `defineConfig` from `vite` (`No test suite found in file`)

Opened this issue · 1 comments

Environment

  • Operating System: Darwin
  • Node Version: v18.20.1
  • Nuxt Version: 3.6.5
  • Nitro Version: 2.5.2
  • Package Manager: yarn@4.1.0
  • Builder: vite
  • User Config: srcDir, buildDir, modules, ssr, nitro, serverHandlers, css, components, imports, build, builder, typescript, vue, hooks
  • Runtime Modules: @nuxt/test-utils/module@3.12.0
  • Build Modules: -

Reproduction

Unfortunately I could not reproduce this behaviour in a fresh repo.

Describe the bug

Using defineVitestConfig from @nuxt/test-utils gives me some errors on random(?) test files located in a specific folder (./src/plugins/ in this case). It seems that vitest doesn't find those tests inside this directory (No test suite found in file /omniweb/gsd/src/plugins/frontend-commons.spec.ts). I tried to place a simple test.spec.ts inside with a basic test but it doesn't pick that up either.
However if I move those test files to another directory at the same level (plugins2) it runs those test. If I rename the folder to plugins it again does not run those test files...

I really can't imagine what's going on here. Are there some forbidden path patterns for some reason?

Additional context

If I use defineConfig from vite these tests will run. But I need to use the Nuxt import since it helps with those nuxt import aliases like #app etc.

Logs

No response

I am also getting this issue, but it's related to latest vitest versions, it was not present before