karma-runner / karma-runner/karma

Duplicate console log messages when conflicting reporters are defined

Open
#2,342 17 comments 17 reactions 0 assignees View on GitHub
discuss
Dominant language
JavaScript
Stars
12k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

### 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.

Contributor guide

Open the contributing guide

Research direction

Start with the reporter configuration in karma.conf.js and reproduce the duplicate output using the listed Mocha, coverage, and karma-remap-istanbul reporters. Read how the two conflicting reporters handle console.log messages, then verify that enabling both preserves their other functionality while each message is emitted only once.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
testing-qa
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.