We currently work on a project used Vue 3 + typescript and reports coverage seems to be not accurate.
With the same lcov.info provided, we have differences between local and ci environments.
In vue 3 components single file with typescript support, import statements are not covered in sonarcloud while it is not the case in local environment.
Sonar Scanner : v4.7.0.2747 (sonarqube-scanner npm package)
CI : Github actions
Langage : Vite + Vue 3 + Typescript
Unit / Acceptance tests : Jest 26.6.3, vue-jest 5.0.0-alpha.10
Component tests : Cypress 10.3.0, nyc 15.1.0
Have you already encountered this issue ? Have you got a solution to fix this issue?
We use nyc to instrument code coverage and run our components tests with cypress, it generates lcov.info and reporter html.
We use jest to instrument code and run our acceptance tests, it generates lcov.info and reporter html too.
We both use the same tools in ci and local environement.
Import statements are correctly covered in local when I directly open the html report.
So I tried to use genhtml (a ubuntu package) to reverse lcov.info and generate html report because I think there is an issue with lcov.info provided to sonar ; Imports statements are still covered with this operation.
When we provide lcov.info which be generated in ci environement.
To complete my previous response, we don’t use a sonarqube instance to generate reports in local.
Any suggestions to give me in order to fix this issue ? We can’t put in place an accurate test strategy with this issue.
Would you have a code snippet or project template to share so we could reproduce your issue and investigate it?
Imports that are exclusively used for typing are not highlighted in Sonarqube, but they might not be in the coverage HTML either. Could that be the case in your issue?