If you use the Solarized Dark terminal theme (very popular), then you can't see the majority of the terminal output for success or error. Bower had a similar problem with a certain shade of grey effectively being invisible.
It's the color code 90 to be specific, used in color names like pass, fast, light etc.
Yeah I’ve noticed the same, also with other themes (such as tomorrow theme). I opened a pull request on the solarized theme (altercation/solarized#240) but it causes other issues so I’m thinking maybe it’s more of a problem with the apps themselves then with the theme.
I’m not sure 90 maps to which color... I’m guessing it’s black?
solarized is strange and for some reason does not display gray, but this is a theme problem
@visionmedia stupid question maybe but where can I find the meaning of the numbers you use for colors? 90, 31, 92..... I couldn’t find. 90 means gray?
This is disappointing. The issue can be easily fixed by changing a color value in Mocha. We did it for Bower. I can't see the point in not making a small change when a lot of people use Solarized, and a non-breaking fix in the theme itself is extremely non-trivial. I hope you'll reconsider. Thanks
Seems that other themes also experience this problem - altercation/solarized#220 (comment)
Bower and (I think) Yeoman changed their colors to avoid theme problems with this gray. Hopefully you'll consider making this small change to Mocha too.
I've done a bit of research and it really seems more like a theme problem. I patched the solarized iterm2 and vim themes on my end to fix the problem, just not sure it is the right/best solution.
It's definitely a theme problem, I don't want to code around themes.
Obviously. But other tools have made a simple change to avoid the problem, which is not unique to Solarized.
@necolas Try using the colors module (https://github.com/Marak/colors.js) and do:
You’ll get invisible text in solarized which doesn’t make sense. It’s not like there are a thousand ways to do this either. Grey should be grey no matter what theme you use I’d say.
Feel free to try out my fork at https://github.com/hydrozen/solarized. I tweaked the iTerm2 and vim themes slightly.
Yeah, colors.js's grey is what was responsible for the problem in Bower. But there's more than one color of grey. We just got rid of it for the sake of end users. Anyway, hopefully Ethan can get a fix into Solarized since TJ has closed this issue.
For those who don’t want to modify Solarized (as it may break other applications, e.g. Vim), and don’t want to modify Mocha itself, you can pretty easily replace all the escape codes in question with perl/sed and some creative Bash redirecting (I replaced the problem color code with 92, which seems to work well in standard Solarized Dark):
mocha -c "$@" > >(perl -pe 's/\x1b\[90m/\x1b[92m/g') 2> >(perl -pe 's/\x1b\[90m/\x1b[92m/g' 1>&2)
Not to hard to make a wrapper function that encapsulates this and handles args (function is easier so you can still lookup the real one in the $PATH). Might as well include my function here (Zsh & Bash compatible):
if type whence &> /dev/null; then
mocha=$(whence -p mocha)
mocha=$(type -P mocha)
$mocha -c "$@" > >(perl -pe "$substitution") 2> >(perl -pe "$substitution" 1>&2)
I’ve since replaced this with a bash script rather than function so it gets picked up better by other commands.
pretty sure vim works fine with other themes :p I fail to see how displaying gray would have any effect on that
Changing the color associated with ANSI escape code 90 in Solarized Dark (so one can see Mocha’s output) breaks Vim colors when using Solarized Dark, which may make changing the color a non-option. See altercation/solarized#240.
damn, that sucks, I guess "light black" could be interpreted many ways :S
@amarshall I only had to do a minor tweak to the vim solarized dark theme theme to fix it in my branch. I don’t use vim a lot, but it seemed to fix it at first glance (if used with my fixed version of solarized dark for iterm). See hydrozen/solarized@13d13ea.
@amarshall I just checked, It seems pretty close, but there are still some glitches in the vim theme. For example, the class/end keywords still have a gray background.
The author of solarized said he was going to look into it when Paul Irish stepped in... still waiting though..
@visionmedia I don’t even know what this is called, I’ve seen 90 referred to as bright black, light black, and dark grey. It’s non-standard anyway, which is probably part of the issue.
@hydrozen Indeed, and I’d rather avoid bugs elsewhere and instead “fix” Mocha’s output. It’s been nearly two years since I saw this same issue but with RSpec’s output, and it only got fixed because RSpec changed, not Solarized.
I use 90 everrrrrywhere haha, all my code is doomed
@visionmedia 🙈 it just keeps the Perl monkeys at work ;)
@amarshall I pushed another commit on my branch which seems to help. So with the iterm2 theme and vim theme from my branch, there’s no invisible output from mocha and terminal vim looks like this with ruby code:
If you use vim a lot than you could confirm if my fix seems to work or not. Also, I’d be curious to see the commit where rspec fixed that issue.
@hydrozen See rspec/rspec-core#393.
As per altercation/solarized#164, this is easly fixed by uping the contrast in iterm2 (I found a about a third from the left to be optimal)
@mbrevda thanks for the simple solution.
Not a solution but this will 'patch' mocha to update the colours to a more solarized-friendly version. Run it in your working directory after an npm install to affect local versions of mocha, or in /usr/lib/node_modules (on my unix machine at least) to affect a global install of mocha.
locking; please file a ticket here
fwiw I use "Solarized Darcula" on iTerm 2 and have no problems.
Fix invisible text in Mocha output.
Fixes by changing brblack to base01, instead of background color.
See mochajs/mocha#802 and
altercation/solarized#220 and many other issues...