Hi, in our Angular project we have enabled code coverage along with other check in sonar. When I run locally the tests, I can see coverage folder is getting generated and within that I can see Icov.info file as well as other default folders and files and the test results are showing all fine. But When I tried to run the pipeline it always says 0.0. So as part of troubleshooting I tried to ran the sonar against the local still the same error. Here are my sonar properties file.
sonar.host.url= URL
sonar.login=Token
sonar.projectKey=projname
sonar.projectName=projname
sonar.projectVersion=1.0
sonar.sourceEncoding=UTF-8
sonar.sources=src
sonar.exclusions=**/node_modules/**, src/**/*.model.ts, src/**/*.constant.ts
sonar.tests=src
sonar.test.inclusions=**/*.spec.ts
sonar.typescript.lcov.reportPaths=coverage/projname/lcov.info
part of my karma config:
coverageIstanbulReporter: {
dir: require('path').join(__dirname, './coverage/projname'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
},
coverageReporter: {
type: 'cobertura',
dir: 'testresults',
subdir: 'coverage',
file: 'code-coverage.xml',
},
junitReporter: {
outputDir: 'testresults/junit',
outputFile: 'unit-test-result.xml',
useBrowserName: false,
},
reporters: ['progress', 'kjhtml', 'junit'],
Here is the Error
We are using Angular 11, Node 14.17.1, Sonar Enterprise version 9.1