karma-runner / karma-runner/karma-coverage

No output with multiple reporters

Open
#480 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
771
Forks
242
PR merge metrics
No merged PRs in 30d

Description

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?

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the reported NodeJS API configuration with karma-coverage and karma-sonarqube-reporter, using the package versions listed in the issue. Compare the reporter combination with the working mocha-and-coverage setup. Done means the coverage report is no longer empty when sonarqube is enabled, with the existing coverage outputs still generated.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.