I am working with vuejs files, the scanner works well but I have 0% coverage on sonarcloud.io
When I run coverage in local, it shows that my tests works fine.
So after tests, a cobertura-coverage.xml file is created and can’t be parsed by sonar scanner
ERROR: Error during parsing of the generic coverage report '/builds/Core4Tech/drowsiness/front/coverage/cobertura-coverage.xml'. Look at SonarQube documentation to know the expected XML format.
ERROR: Caused by: Unknown XML node, expected "file" but got "sources" at line 4
I have read that it is possible to convert this file with a plugin but I have no idea of how to it
And also, I have this in logs
INFO: Sensor JavaScript/TypeScript Coverage [javascript]
INFO: No LCOV files were found using coverage/lcov.info
WARN: No coverage information will be saved because all LCOV files cannot be found.
but when i run tests, a lcov.info file is created too :
lcov.info file is located in coverage/ directory.
He is created after running “npm run test”
“test”: “NODE_ENV=test jest --reporters=jest-junit --reporters=default --coverage”
After tests, two files are imported, cobertura-coverage.xml & junit.xml
After deleting all coding lines in link with cobertura.
I have now a succesful pipeline but 0 coverage on sonarcloud.
Still in the logs I have this
INFO: Sensor JavaScript/TypeScript Coverage [javascript]
INFO: No LCOV files were found using coverage/lcov.info
WARN: No coverage information will be saved because all LCOV files cannot be found.
My sonar-project.properties :
sonar.projectKey=key
sonar.organization=orga
sonar.projectName = Front
sonar.language=js
sonar.sources=.vscode,adapters,api,assets,components,domain,layouts,locales,middleware,pages,plugins,services,static,store
sonar.tests=tests
sonar.javascript.lcov.reportPaths=coverage/lcov.info
#sonar.testExecutionReportPaths=test-report.xml
He also don’t find test-report.xml but he’s created when I run tests in local
ERROR: Caused by: /builds/Core4Tech/drowsiness/front/test-report.xml (No such file or directory)
If you are running your tests in a separate docker container than the scanner is running (feel free to share your gitlab-ci.yml file), naturally the scanner is not going to be able to pick up the report because as far as it’s concerned… it doesn’t exist.
This sounds like the right path. It will be important that you’re able to run a cat coverage/lcov.info before the sonar-scanner and that your coverage data exists.