Description
Environment
- Operating System: Darwin
- Node Version: v18.16.0
- Nuxt Version: 3.11.2
- CLI Version: 3.11.1
- Nitro Version: 2.9.6
- Package Manager: [email protected]
- Builder: -
- User Config: devtools, typescript, extends, components, ssr, runtimeConfig, app, css, build, modules, experimental, i18n, proxy, vite, public, nitro, hooks
- Runtime Modules: @pinia/[email protected], [email protected], [email protected], @nuxt/test-utils/[email protected], @nuxtjs/[email protected]
- Build Modules: -
Reproduction
vitest --coverage is not working in StackBlitz. Please download the project and try it locally.
Describe the bug
Description:
When the components option in the Nuxt configuration is set to true (enabling automatic global registration of components), the test coverage report shows 100% coverage for all components, regardless of whether tests actually exist for them. Something is importing the untested TestNestedUntested. V8 is reporting coverage for it. Maybe Nuxt imports all those files.
Actual Behavior:
The coverage report incorrectly shows 100% coverage for all components, including those without any tests like TestNestedUntested.vue in component directory. Seems to be a problem caused by nuxt importing all files.
Expected Behavior:
The coverage report should accurately reflect the coverage for each component. Only TestNested.vue should show 100% coverage, while TestNestedUnested.vue should show 0% coverage or appropriate coverage based on the absence of tests.
Additional context
No response
Logs
No response