nuxt / test-utils

🧪 Test utilities for Nuxt
http://nuxt.com/docs/getting-started/testing
MIT License
312 stars 80 forks source link

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

Open Llois41 opened 5 months ago

Llois41 commented 5 months ago

Environment

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

ennioVisco commented 5 months ago

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