Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix duplicated logs with multiple reporters #5

Merged
merged 4 commits into from
Sep 11, 2024

Conversation

JTMCaplin
Copy link
Contributor

@JTMCaplin JTMCaplin commented Dec 18, 2023

Fixes duplicated logs from #4

@JTMCaplin JTMCaplin closed this Dec 18, 2023
@JTMCaplin JTMCaplin reopened this Dec 18, 2023
@JTMCaplin JTMCaplin closed this Dec 19, 2023
@JTMCaplin JTMCaplin reopened this Dec 19, 2023
@JTMCaplin
Copy link
Contributor Author

Sorry for opening and closing several times, went through a few different iterations.

Okay, have adjusted this to work correctly now. Issue can be reproduced by using the dots reporter along with jasmine-order. In karma config have reporters: ["dots", "jasmine-order"].
This causes an issue, since as it's a child class of the base reporter, it outputs console statements from the browser, and there's also another reporter, in this case dots, which also outputs console statements from the browser, you end up with two lots of console statements.

Originally had it disabled when it's not the last order, as angular had done, but it doesn't actually matter what order the list is. Unfortunately removing normal commonMsg logging removes ability for browser.log to work, so switched to using the base write function instead.

So instead I've added a config option which can be enabled when using the reporter with other reporters that cause this issue, and can be set to false if the other reporter doesn't log, allowing best of both worlds.

@dil-btarkovacs
Copy link

any willing to merge this?

Copy link
Owner

@dmitryshindin dmitryshindin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dmitryshindin dmitryshindin merged commit cd639cc into dmitryshindin:master Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants