Code coverage and .global.vue components
I started writing unit tests for my components, and I also want to generate code coverage reports. I managed to set up everything (Nuxt test utils make everything nice and easy, thanks Nuxt team!). I'm able to run the tests with --coverage and get the report. The only problem seems to be that the coverage says that all my global components are 100% covered. I'm wondering if someone else is dealing with this or dealt and found some solutions. Thanks
4 Replies
I'm encountering the same issue. Did you find a solution?
probably, it's better to share your setup
I have it working
I also have it working on several other projects but cannot reproduce it in a starter project with the same config. Unfortunately, I cannot share the affected project.
A short update here: My colleague raised Github issues for vitest (https://github.com/vitest-dev/vitest/issues/6029) and nuxt (https://github.com/nuxt/test-utils/issues/891). We added a short reproduction that shows that the
components
option in the nuxt.config.ts seems to be the culprit here. We would be happy about any insights or suggestions you might have to help resolve this issue.GitHub
Coverage stays at 100% for components regardless of the existence o...
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% coverag...
GitHub
Issues · nuxt/test-utils
🧪 Test utilities for Nuxt. Contribute to nuxt/test-utils development by creating an account on GitHub.