which versions are you using: SonarQube Community Edition v10.5.1, sonar-scanner 5.0.1.3006
how is SonarQube deployed: Helm
what are you trying to achieve:
Recently some e2e tests have been added to a project we were already analyzing on Sonarqube. The tests are successfully execute using cypress and at the end an lcov.info file is being generated. We are trying to upload this lcov.info file to Sonarqube in order to get Coverage %.
In order to do so we first added the following line in our sonar-project.properties file: e2e.sonar.javascript.lcov.reportPaths=cypress/coverage/lcov.info
From the logs we can tell that Sonar finds and reads lcov.info but it cannot resolve the paths included in it:
13:10:45.637 DEBUG: Property sonar.javascript.lcov.reportPaths is used.
13:10:45.637 DEBUG: Using ‘cypress/coverage/lcov.info’ to resolve LCOV files
13:10:45.637 INFO: Analysing [/home/jenkins/agent/workspace/project-cypress-analysis_master/e2e/cypress/coverage/lcov.info]
13:10:45.664 WARN: Could not resolve 194 file paths in [/home/jenkins/agent/workspace/project-cypress-analysis_master/e2e/cypress/coverage/lcov.info]
13:10:45.664 DEBUG: Unresolved paths:
…/project-ui/src/main.ts
…/project-ui/src/polyfills.ts
…/project-ui/src/app/app.component.html
…/project-ui/src/app/app.component.ts
…/project-ui/src/app/app.constants.ts
…/project-ui/src/app/app.module.ts
…/project-ui/src/app/app.routes.ts
…/project-ui/src/app/attribute/attribute.service.ts
…/project-ui/src/app/auth/auth.service.ts
…/project-ui/src/app/authority/authority-fields.service.ts
…
what have you tried so far to achieve this:
We have tried changing the paths to any possible combination: full path, relative path, etc. Nothing worked. We even downgraded "ts-node" to "10.7.0" because in a similar post we read that it solved the issue, but it did not in our case. Could it be that cypress configuration and the lcov.info are in directory ‘e2e’ and the paths mentioned in lcov.info are in a different directory (‘project-ui’)?
Any help in order to resolve this would be much appreciated.
Thank you
P.S.: In case it helps I have attached a screenshot that depicts the project’s structure:
Yes, we decided to define e2e as a module because if we specify it as such: sonar.javascript.lcov.reportPaths=e2e/cypress/coverage/lcov.info we receive the following output:
07:33:23.723 INFO: Sensor JavaScript/TypeScript Coverage [javascript]
07:33:23.724 DEBUG: Property sonar.javascript.lcov.reportPaths is used.
07:33:23.724 DEBUG: Using ‘e2e/cypress/coverage/lcov.info’ to resolve LCOV files
07:34:02.521 INFO: No LCOV files were found using e2e/cypress/coverage/lcov.info
07:34:02.522 WARN: No coverage information will be saved because all LCOV files cannot be found
As mentioned above, we tried all possible paths while defining or not defining e2e as a module, but nothing seems to work.
This is what our sonar-project.properties file looks like, in case it helps:
The sonar analysis is running as part of a jenkins job, so the file resides inside a jenkins workspace, with the following absolute path: /nfs-data/jenkins-workspace/workspace/project-cypress-analysis_master/e2e/cypress/coverage/lcov.info
The paths inside that lcov.info which sonarqube claims as “unresolved” are as such: