Hi, I’m trying to get coverage for my Angular 11 mono-repo project on gitlab + AWS environment.
It has combination of karma + jest test and the SonarQube server version is 9.5.0.56709
While I can see my coverage for the project before merge, my coverage is 0% as no lcov file is found.
This is the log when I merge
INFO: Sensor TypeScript analysis [javascript] (done) | time=232156ms
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.
INFO: Sensor JavaScript/TypeScript Coverage [javascript] (done) | time=835ms
and this is the merge request pipeline log (and I get the correct coverage)
INFO: Sensor JavaScript analysis [javascript]
INFO: Deploying custom rules bundle jar:file:/root/.sonar/cache/06b160cbad8e9f8df7328b1a2c5a0afe/sonar-securityjsfrontend-plugin.jar!/js-vulnerabilities-rules-1.0.0.tgz to /builds/YECb221b/0/project/.scannerwork/.sonartmp/eslint-bridge-bundle/package/custom-rules2175062094652070529
INFO: 67 source files to be analyzed
INFO: 67/67 source files have been analyzed
INFO: Sensor JavaScript analysis [javascript] (done) | time=7380ms
Could someone help me to solve this problem? I really don’t understand why I cannot get lcov files only when merging the project while I’m getting it for merge request.
my gitlab script
- npm install -g sonarqube-scanner
script:
- npm run lint:json
- npm run affected:test
- sonar-scanner -Dproject.settings=sonar-project.properties -Dsonar.host.url=$SONAR_HOST_URL
-Dsonar.login=$SONAR_TOKEN -Dsonar.qualitygate.wait=true -Dsonar.projectKey="project"
my sonar-project.properties
sonar.projectKey=project
sonar.projectName=project
sonar.projectVersion=1.0
sonar.sources=apps/,libs/
sonar.exclusions=**/node_modules/**,**/*.spec.ts
sonar.sourceEncoding=UTF-8
sonar.tests=apps/,libs/
sonar.test.inclusions=**/*.spec.ts
sonar.coverage.exclusions=**/*.mock.ts,**/*.js
sonar.javascript.lcov.reportPaths=coverage/**/lcov.info
sonar.typescript.eslint.reportPaths=linter.*.issues.json
Thanks!