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

There is no way of retrieving the code coverage report programmaticaly

Open nicojs opened this issue 9 years ago • 1 comments

For the development of our JS Mutation testing framework stryker we want to programmatically receive the code coverage report. We're using karma via the public api.

Right now: we have 2 issues:

  1. We do not know when the coverage report has been written.
  2. We need to collect the coverage report from disk.

I want to add a new feature: 2 birds with one stone.

I want to raise an event called coverage_complete whenever the reporter is done with a coverage report. In order to do that, i want to add the emitter as inject-able in reporter.js.

Next, i want to add a new reporter type: inMemory or something. When that reporter is active, it will provide the result of collector.getFinalCoverage() to the coverage_complete event. I don't want to add the report to every event throw, because of possible performance overhead. Only when the inMemory report type is in the list.

@dignifiedquire do you agree with this approach?

nicojs avatar Mar 01 '16 14:03 nicojs

Sounds good to me.

dignifiedquire avatar Mar 01 '16 14:03 dignifiedquire