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

add more friendly output for dot reporter in colorless mode #1702

Closed
wants to merge 1 commit into from
Closed

add more friendly output for dot reporter in colorless mode #1702

wants to merge 1 commit into from

Conversation

pcdevil
Copy link

@pcdevil pcdevil commented May 17, 2015

Currently when using dot reporter with no-colors option the dot-matrix output has no use.

To resolve that I want to introduce an extra parameter to the base reporter's color function which is a fallback string if colors are disabled. If this parameter is given the function will return that instead of the original string.

Using this parameter the dot reporter can easily signal the difference between tests and it will output the following:

  • the default dot if the test passes
  • P if the test is pending
  • S if the test is slow
  • F on failure

@jbnicolai
Copy link

I like the suggestion, but there's no way we can merge this without breaking backwards compatibility.

On the other hand, in what bizarre use-case would you use the output of the dot reporter in a script?

@boneskull what do you think? I'd say merge ;-)

@jbnicolai jbnicolai added type: feature enhancement proposal TO-MERGE labels Jun 5, 2015
@pcdevil
Copy link
Author

pcdevil commented Jun 5, 2015

I'm not sure why you are saying it breaks compatibility because now mocha with no-colors only prints plain dots to passed and failed tests too and you can't distinguish them. With this modification you can ;)
But I'm not gonna argue about it, if you want I can duplicate the dot reporter (with dot-detailed or something similar name) and implement this feature in that one - in this way compatibility will be intact and everything will be shiny :)

The notion behind this is get a minimal report but get it meaningfully. Like if you running the test with a build script and redirect the output into a file you have a nice little output of it.

});

runner.on('pass', function(test){
if (++n % width == 0) process.stdout.write('\n ');
if ('slow' == test.speed) {
process.stdout.write(color('bright yellow', Base.symbols.dot));
process.stdout.write(color('bright yellow', Base.symbols.dot, 'S'));
} else {
process.stdout.write(color(test.speed, Base.symbols.dot));
Copy link
Member

Choose a reason for hiding this comment

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

@pcdevil this one too?

@boneskull
Copy link
Member

@pcdevil This is a breaking change because the output of the dot reporter now differs if no TTY is present (for example). Granted, I don't expect anyone is trying to use a machine to parse the output of the dot reporter, but it's just not safe to put this feature into anything other than a major release. If it were any other project, I'd say "go for it", but previously we've altered the output (not the "API") of Mocha in patch or minor releases and it sparked a shitstorm, so no can do. Please rebase against branch v3.0.0.

@hollomancer
Copy link

Handled in #2000.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature enhancement proposal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants