karma-runner / karma-runner/karma-coverage

How to combine the multiple coverage results from various folders to a single html file?

Open
#342 1 comment 4 reactions 0 assignees View on GitHub
type: feature
Dominant language
JavaScript
Stars
771
Forks
242
PR merge metrics
No merged PRs in 30d

Description

I am new to TDD. we have already executed the test cases through **karma-coverage.**. If the test case count increases, the code coverage took more time to complete the job. so i had switched into **concurrenlty** to implement the parallel test case execution. Before that, the code coverage results are generated as single html file. But now, i had configure the coverage results into separate folders to improve the performance on test cases. But now, the coverage results are generated as separate html report. But i want to combine these separate folder's index.html file into single html report.

so that, i have implemented the parallel execution of my repository using **"concurrently"**. I had configured the gulp generate the separate code coverage reports for each folder. Each folder has set of **.spec file** The gulp configuration details is given below,

**gulp zero:**

` coverageReporter: {

dir: './cireports',

subdir: "codecoverage/zero",

reporters: [
{ type: 'html', file: "UnitTestCover.html" },
]

}
`
**gulp one:**

` coverageReporter: {

dir: './cireports',

subdir: "codecoverage/one",

reporters: [
{ type: 'html', file: "UnitTestCover.html" },
]

}
`
**gulp two:**

` coverageReporter: {

dir: './cireports',

subdir: "codecoverage/two",

reporters: [
{ type: 'html', file: "UnitTestCover.html" },
]

}
`

**gulp three:**

` coverageReporter: {

dir: './cireports',

subdir: "codecoverage/three",

reporters: [
{ type: 'html', file: "UnitTestCover.html" },
]

}
`

If I executed following command through command prompt,

**concurrently “gulp zero” “gulp one” “gulp two” “gulp three”**

Test case was executed parallel and the coverage reports generated in the specific folder. Each coverage folder has index.html file. So I need to merge the coverage reports from all folders into single index.html file.

I had tried to merge the coverage reports from following package, [1.](https://www.npmjs.com/package/gulp-concat) So that I had installed the “gulp-concat” from following command,

` npm install --save -dev gulp-concat`

After that, I had configure the gulp.js to merge the coverage reports, The gulp-concat configuration is given below,

**gulp-concat:**

` gulp.task('merge', function () {

return gulp.src(['./cireports/codecoverage/zero/index.html', './cireports/codecoverage/one/index.html', './cireports/codecoverage/two/index.html', './cireports/codecoverage/three/index.html'])
.pipe(concat('index.html'))
.pipe(gulp.dest('./dist/'));

});
`
After test case execution completed, I had executed the “gulp merge” to merge the coverage reports. Expected output was not came. The merged index.html file was generated the series of coverage reports in a single index file

Can anyone tell me whether there is any plan to implement the merging of coverage reports?

Regards,

Creator


[1]: https://www.npmjs.com/package/gulp-concat

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.