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

Feature fix no colors to run command #1902

Conversation

budde377
Copy link
Member

I have not identified and fixed the problem with the 3rd-party reporters not working. The problem was that the reporters didn't update the USE_COLORS property, from its default value: false. The feature relies highly on this property to be updated and when it wasn't, the reporter would be interpreted as a no-color reporter.

In-order not to break backwards compatibility, a new property was introduced: EXCLUSIVELY_USE_COLORS with undefined as it's default value. By using this property, the no-colours feature (in the run command) will work for default reporters, i.e. dots and process, and reporters choosing to update the property.

When fixing this, it became obvious why 3rd-party reporters didn't wan't to update this property: They didn't want to implement two reporters, because this would require for their users to add two reporters to their configuration.

For instance; for the mocha reporter, used in #1894, to implement this feature they would first implement two reporters, say reporter:mocha and reporter:mocha_color, which would yield a configuration as:

reporters: ['mocha', 'mocha_color'] 

where omitting one would disable reporting w/w.o colours, depending on the omitted reporter.

I fixed this in 3294a15 by attempting (silently) to load a "coloured" version of a given reporter. Thus for the mocha reporter to support this feature, all they need to do is implement and export two reporters: reporter:mocha and reporter:mocha_color. The user-configurations would remain unchanged: I.e.

reporters: ['mocha'] 

Given a reporter with name foo the coloured version must be named foo_color, i.e. with postfix _color.

@dignifiedquire
Copy link
Member

This looks good but just to be sure can you add a e2e test using the mocha reporter that checks for the correct output please?

@budde377
Copy link
Member Author

@dignifiedquire Yes, I'll add it this weekend.

@dignifiedquire
Copy link
Member

@budde377 thanks. Do you want to join the karma maintainer team? Main rules are, keep doing great work like you did, and don't push/merge to master on your own.

@budde377
Copy link
Member Author

@dignifiedquire Yes, I would very much like that :)

@dignifiedquire
Copy link
Member

@budde377 done, welcome to the team

@dignifiedquire dignifiedquire modified the milestone: v1.0 Feb 19, 2016
@budde377 budde377 force-pushed the feature-fix-no-colors-to-run-command branch from 14ae540 to 4ca7378 Compare February 21, 2016 09:39
@budde377
Copy link
Member Author

@dignifiedquire Here you go!

@dignifiedquire
Copy link
Member

@budde377 this needs a rebase after I merged your other PR

@budde377 budde377 force-pushed the feature-fix-no-colors-to-run-command branch from 4ca7378 to 73b7cdf Compare February 22, 2016 10:06
@budde377
Copy link
Member Author

@dignifiedquire, Here you go ;)

@dignifiedquire
Copy link
Member

Thanks. Here goes nothing

@dignifiedquire
Copy link
Member

Damn. There is another conflict sorry

 Add colors and log-level arguments to run argument.
 Refactor log-setup functions for server and init.
 Correct bug in server where log-level was ignored before `parseConfig`

Closing karma-runner#1067
Delay the decision on color/no-color reporter to write. This is
done by letting the individual adapter decide the color and providing
a default color to the base adapter.

Closing karma-runner#1067
Fix problems:
 * Not relying on Reporter.USE_COLORS property
 * Construct factory with right configuration
When loading a reporter, look for a color-version of this.
 Add a test of the karma-mocha-reporter. Testing that it outputs
 correctly.
@budde377 budde377 force-pushed the feature-fix-no-colors-to-run-command branch from 73b7cdf to 76cdd60 Compare February 22, 2016 16:55
@budde377
Copy link
Member Author

No prop. This should do the trick.

dignifiedquire added a commit that referenced this pull request Feb 22, 2016
…ommand

Feature fix no colors to run command
@dignifiedquire dignifiedquire merged commit d3bec1e into karma-runner:master Feb 22, 2016
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