mantoni/mochify.js

Colors not working with Mocha 2.4 anymore

Closed this issue ยท 16 comments

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

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.

Related issue on Mocha repo: mochajs/mocha#2080

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.

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

Cool, thanks! ๐Ÿ‘

@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)

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

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

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

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

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

@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? ๐Ÿ˜€

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

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

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

Happy testing!