karma-coverage icon indicating copy to clipboard operation
karma-coverage copied to clipboard

No output with multiple reporters

Open neutraali opened this issue 3 years ago • 0 comments

Using the NodeJS API, let's say our config is like this:

let KarmaConfig = {
	plugins: [
		'karma-chai',
		'karma-mocha',
		'karma-sourcemap-loader',
		'karma-webpack',
		'karma-mocha-reporter',
		'karma-chrome-launcher'
	],
	singleRun: true,
	autoWatch: false,
	frameworks: ['mocha', 'chai', 'webpack'],
	reporters: ['mocha'],
	// . . . 
};

If I add the coverage -stuff, everything works fine:

KarmaConfig.plugins.unshift('karma-coverage');
KarmaConfig.reporters.push('coverage');
KarmaConfig.coverageReporter = { // https://github.com/karma-runner/karma-coverage
	dir: 'test/coverage',
	reporters: [
		{ type: 'text' },
		{ type: 'text-summary' },
		{ type: 'lcovonly', subdir: '.', file: 'istanbul-coverage.txt' }
	]
};

However, if I add stuff like sonarqube the code coverage reporting stops working (results in an empty coverage report; mocha and sonarqube reporters work fine):

KarmaConfig.plugins.unshift('karma-sonarqube-reporter');
KarmaConfig.reporters.push('sonarqube');
KarmaConfig.sonarqubeReporter = { // https://github.com/fadc80/karma-sonarqube-reporter
	basePath: 'test',
	outputFolder: 'test/coverage',
	filePattern: '**/*.js',
	encoding: 'utf-8',
	reportName: 'sonarqube-execution.xml'
}

All this is with:

"karma": "6.3.19"
"karma-chai": "0.1.0"
"karma-chrome-launcher": "3.1.1"
"karma-coverage": "2.2.0"
"karma-mocha": "2.0.1"
"karma-mocha-reporter": "2.2.5"
"karma-sonarqube-reporter": "1.4.0"
"karma-sourcemap-loader": "0.3.8"
"karma-webpack": "5.0.0"

Anyone else experiencing this kind of issue?

neutraali avatar Aug 10 '22 12:08 neutraali