Coverage reports not accurate Vue 3 + Typescript

Hello,

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?

Thanks in advance,

Regards,

Hey there.

When you speak about your local environment – what are you referring to? A SonarQube instance? Another visualization of your coverage data?

Hello,

Thank you for your response.

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.

Here you are my sonar-project.properties :

sonar.projectKey=*********
sonar.sources=src
sonar.host.url=https://sonarcloud.io
sonar.organization=*******
sonar.typescript.lcov.reportPaths=reports/coverage/**/lcov.info

Import statements are not covered whereas any statements which use these import are covered.

Hello,

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.

Any help is appreciated.