I am trying to scan the coverage of my code using coverageIstanbulReporter
on the sonarqube. Here is my karma.conf.js file:
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular/cli'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular/cli/plugins/karma')
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
reports: ['html', {
'lcovonly': {
"directory": "coverage",
"filename": "lcov.info",
"subdirectory": "lcov"
}
}],
fixWebpackSourcePaths: true
},
angularCli: {
environment: 'dev'
},
reporters: ['progress', 'kjhtml', 'dots'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false
});
};
My build.gradle file has properties for sonar:
sonarqube {
properties {
// Sonar Specific properties
property 'sonar.host.url', '' // This is the Sonar Server
property "sonar.projectName", ""
property "sonar.projectKey", ""
property "sonar.sources", "./src"
property "sonar.exclusions", "**/*.spec.js,**/test.ts,"
property "sonar.language", "ts"
property "sonar.typescript.lcov.reportPaths", "coverage/lcov/lcov.info"
property "sonar.test.inclusions", "**/*.spec.ts"
}
}
Now, the problem is, the coverage on sonar doesn't reflect the coverage that I have tests for. Also, running locally I am not able to see the coverage/lcov/lcov.info file in my machine.
I am not sure what's going wrong in my code.