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

Colors not working with Mocha 2.4 anymore #129

Closed
mantoni opened this issue Jan 27, 2016 · 16 comments
Closed

Colors not working with Mocha 2.4 anymore #129

mantoni opened this issue Jan 27, 2016 · 16 comments

Comments

@mantoni
Copy link
Owner

mantoni commented Jan 27, 2016

I saw a few commits and releases around chalk in Mocha. Maybe @boneskull can help shed some light on the issue?

@mantoni
Copy link
Owner Author

mantoni commented Jan 28, 2016

Ok, with the latest Mocha fixes, Mochify stopped working completely. I'm going to nail the dependency to mocha@~2.3.4 for now. @boneskull I can really use your insight here.

@mantoni
Copy link
Owner Author

mantoni commented Jan 28, 2016

Related issue on Mocha repo: mochajs/mocha#2080

@boneskull
Copy link
Collaborator

We replaced the custom colors with chalk since people were complaining about it for years.

because chalk uses ie8 incompatible code it was stubbed out.

However I now realize that consuming mocha on the command line via phantomjs will cause it to be stubbed as well.

The solution is then to not stub chalk but instead polyfill some es5 stuff. I'll do this tomorrow.

@boneskull
Copy link
Collaborator

Have sympathy for trying to support old node, old browsers, and browsers that run in terminals all at once...

@mantoni
Copy link
Owner Author

mantoni commented Jan 28, 2016

Cool, thanks! 👍

@gyandeeps
Copy link

@mantoni Even when mocha start working the colors on windows will not show up: https://twitter.com/gyandeeps/status/692355912233787393

because of how chalk detects whether terminal can support colors or not. Which indirectly is an issue with node (I guess)

@boneskull
Copy link
Collaborator

@gyandeeps We can probably work in some hack to make chalk output color in windows. If it worked before, we can make it work again. However, if you're using phantomjs at this point, you're SOL. I'll be on this in a few.

@gyandeeps
Copy link

@boneskull Sure. Let me know if you need some help with it.

@mantoni
Copy link
Owner Author

mantoni commented Jan 28, 2016

@gyandeeps Thanks for sharing. I know about the issues with stdio in the Cygwin context. It's a never ending source of fun for me at work.

Mochify detects color using the supports-color module and explicitly configures Mocha using the useColors API. As long as that API allows me to explicitly enable / disable colors, everything should continue to work as it did before.

@gyandeeps
Copy link

supports-color didnt work for me using git bash on windows when running commands through npm.

@mantoni
Copy link
Owner Author

mantoni commented Jan 28, 2016

Didn't try git bash yet. We're using npm scripts in cygwin / mintty and that works fine.

@gyandeeps
Copy link

Even the travisci build dont show color anymore.
https://travis-ci.org/eslint/eslint/jobs/105491101#L479
vs
https://travis-ci.org/eslint/eslint/jobs/104153134#L478 (old)

@mantoni
Copy link
Owner Author

mantoni commented Jan 28, 2016

@gyandeeps You're talking about Mocha now. Mochify is a slightly different story. You're not testing eslint in the browser with Mochify, do you? 😀

@gyandeeps
Copy link

Nope. I was on the convo of using supports-color.

@boneskull
Copy link
Collaborator

please see mochajs/mocha#2080 for status and further info

@mantoni
Copy link
Owner Author

mantoni commented Feb 1, 2016

Issue fixed in Mocha 2.4.5. Released mocaccino 1.8.2 which rolls back the temporary workaround.

Happy testing!

@mantoni mantoni closed this as completed Feb 1, 2016
islemaster added a commit to code-dot-org/code-dot-org that referenced this issue Mar 2, 2016
mocha: ^2.3.4 to ^2.4.5
mochify: ^2.15.0 to ^2.17.0

There's an intermediate version of mocha (>2.4.0, <2.4.5) that broke compatability with PhantomJS by its use of a particular color output library, documented here: mantoni/mochify.js#129

Bumping to this version ensures we're past that bug, which is fixed in 2.4.5 (https://github.com/mochajs/mocha/blob/master/CHANGELOG.md#245--2016-01-28)
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

No branches or pull requests

3 participants