I am using sonarqube-scanner npm package version 2.7 in a gitlab pipeline. Now I am trying to separate the unit testing job in 2, creating 2 reports and loading them into sonarqube. I tried updating to the latest sonarqube-scanner version(4.2.5), but that version tries to detect a proxy which, to my knowledge, we don’t have.
I tried adding a new job, which merged the reports, but I had the same error. The strange thing is that the job ends successfully, but in MR it still shows ‘No data about coverage’.
I added a third party package to generate a report for the property sonar.testExecutionReportPaths and since then I get duplication data, but still no coverage data
Welcome to the community and thanks for the thoroughness of this report!
I see this in your log:
14:51:34.059 WARN: Could not resolve 7 file paths in [/builds/[PROJECT_PATH]/[PROJECT_KEY]/coverage/jest/cobertura-coverage-1.xml, /builds/[PROJECT_PATH]/[PROJECT_KEY]/coverage/jest/cobertura-coverage-2.xml, /builds/[PROJECT_PATH]/[PROJECT_KEY]/coverage/jest/shards/lcov-1.info, /builds/[PROJECT_PATH]/[PROJECT_KEY]/coverage/jest/shards/lcov-2.info]
14:51:34.059 DEBUG: Unresolved paths:
src/app/config/api-paths.ts
src/app/definitions/core/global-api.definition.ts
src/app/definitions/features/kis/kis-api.definition.ts
src/app/definitions/features/mako/mako-api.definition.ts
src/app/definitions/features/tabellenpflege/tabellenpflege-api.definition.ts
src/app/definitions/features/verbrauchsstatistik/verbrauchsstatistik-api.definition.ts
src/app/definitions/features/vmp/vmp-api.definition.ts
So at least some file paths in the report aren’t recognized. The log says 1555 files are analyzed, but how many should be in the coverage report? All of them? Only 7? Something in between?
Thank you for the prompt response! Every file, but those 7 get generated automatically so are not important for the coverage. Can you comment on the log when I update?
I also plan on creating a support ticket as soon as I can, since I have the developer edition
According to the Sonar Scanner configuration file, you are declaring coverage reports in both LCOV and Cobertura formats. Note that only LCOV is supported by the JS analyzer, but it is resilient enough to not crash when encountering Cobertura reports.
In the logs, we see that 4 reports are actually found by the analyzer:
Hi @koestnei, sorry for the delay. We have been trying to reproduce your issue without success. Could you please put a public repository in place with a minimal reproducible example so that we can investigate and provide support?
My point is I could pull the minimal reproducible project that you share and analyze it with my own local instance of SonarQube to try and understand the issue.
Turns out the config that I sent is correct. After using the jest shard option to separate the tests, I changed some of the code and then the reporter was shown as expected. When there is no changes in ts code the reporter show ‘No coverage data’ which is confusing, but not wrong.