#2342·karma

Duplicate console log messages when conflicting reporters are defined

Author: eklundjoshuaCreated Aug 31, 2016Updated Mar 26, 2025
Labelsdiscuss

Description of the problem:

In our project we have both Mocha & Remap-Istanbul defined as reporters for our Karma Tests. It seems as though these two reporters both have similar functionality in that they both intercept console.log messages that are written out from the JavaScript so there are always two log messages for every console.log message that we write. I do not think there is a feature yet, but it would be neat to add functionality that basically disables console.log messages for one plugin but leaves them for another so that way you can have the functionality of both plugins but only allow 1 of them to output console.log messages.

Environment Details

Karma Version 0.13.22

Steps to reproduce the behaviour

  1. Defined reporters: ["mocha", "coverage", "karma-remap-istanbul"] in the karma.conf.js for my angular app
  2. Ran my tests
  3. Console logs that were written in the code were duplicated for every test that had been executed.
  4. Removed "karma-remap-istanbul" from the reporters list, reran the tests, and the duplication went away.
  5. Added "karma-remap-istanbul" back to the reports list and removed "mocha", reran the tests, and the duplication went away.