Color in test output using latest Sublime Text 2 build #33

mhartl opened this Issue Jan 18, 2012 · 53 comments


None yet
mhartl commented Jan 18, 2012

These Sublime Text Ruby test functions are great, and I'm hoping to use them in the next edition of the Ruby on Rails Tutorial screencasts. Unfortunately, it looks like color test output might have been broken by the latest Sublime Text 2 beta (build 2165). Ever since upgrading, when I run the tests inside of Sublime Text the output console still appears, but the colors for passing/failing tests are gone. You can see what I mean in this screenshot. Any help getting this fixed before I start recording the next edition of the screencasts (in the next couple of weeks) would be greatly appreciated.


In addition, when a test fails, you get the color codes in the output instead of the colors. As an example:

Finished in 1.770297 seconds.

  1) �[31m�[1mFailure�[0m:
�[34m�[1mtest_needs_update_no_default_cost(CustomChargeSettingTest)�[0m [�[32m�[1mtest/unit/custom_charge_setting_test.rb:51]:
�[34m�[1m<true> �[1m�[7mexpected but was�[0m�[0m
mhartl commented Jan 18, 2012

I can't reproduce the problem with color codes, but by downgrading to build 2139 I've confirmed that it's build 2165 that causes the colors to disappear.

mhartl commented Jan 18, 2012

I haven't been able to track down the bug, but I've found a kludgy workaround. The problem is that Sublime Text isn't even loading the theme file for the RubyTest widget. Here's the hack:

Edit the file "Theme - Default/Widget.sublime-settings" in the Library/Application\ Support/Sublime\ Text\ 2/Packages directory:

$ subl "Theme - Default/Widget.sublime-settings" 

In that file, change

"color_scheme": "Packages/Theme - Default/Widgets.stTheme"


"color_scheme": "Packages/RubyTest/TestConsole.tmTheme"

By changing the default color theme, this probably screws up other widgets, but since the RubyTest widget is the only one I currently use I can live with that.

gs commented Jan 19, 2012

That looks good now!

Thanks for sorting this out.


@gs gs closed this Jan 19, 2012

I am on Build 2178, did the steps Michael recommended, restarted Sublime from the command line - and still was stucked with black on white text.

As I am using the Soda Light Theme, I had to edit the according file:

subl ~/Library/Application Support/Sublime Text 2/Packages/Theme - Soda/Soda Light/Widget\ -\ Soda\ Light.sublime-settings

And finally I got a colorful output.


@mhartl comment fixed it for me, thanks


Hmmm, neither editing the Default theme widget settings or the light or dark soda theme widget settings would get the color to show up in the text execution window for me... odd... I'm on the latest dev build 2180. Did that break even this fix?


As of today I am also running build 2180 - the colored console output is still fine.


Here's a screenshot of my settings files and a test I tried to run I found that the RubyTest settings file has --no-color specified which would seem to be the culprit, so I edited the prefs file to remove that flag and it was still just white text in the test console. Then I added the --color flag explicitly and now I'm seeing the escaped color output mentioned above as well. Any help would be greatly appreciated! Thanks!


I even tried using AppZapper and removing all traces of Sublime Text 2 and re-installing the latest dev build, then following the instructions here and still can't get it to work with either the default theme or soda. Bummer...


Wow... I even reverted to the build Michael said it worked on 2139 and didn't change anything except for installing package control and RubyTest and Cucumber, then tried running this test... white text still. Sorry to be such a bother, I just would very much like to get this working!!


I guess the syntax highlighting just doesn't yet support Cucumber because I was able to get it working in a generic RSpec file. Any plans to add Cucumber support for syntax coloring of output?

gs commented Feb 21, 2012

added colors for cucumber test output


Hi guys, I added some additional coloring in a pull request but could use some help to determine if the coloring can be improved. Please see the open pull request here -



I'm on Build 2181 and Coloring still does not work. I've tried all the solutions in here.

gs commented Jun 20, 2012

Are you using Soda theme or some other themes?

Please refer to #33 (comment) . This solves standard problems with coloring.



"color_scheme": "Packages/Color Scheme - Default/Monokai Bright.tmTheme",
"font_size": 18.0,
"soda_classic_tabs": true,
"tab_size": 4,
"theme": "Nil.sublime-theme",
"translate_tabs_to_spaces": true,
"use_tab_stops": true


I have been struggling with this all afternoon. I have resolved it by going to Preferences -> Settings -> User and deleting the 'theme' entry (which was set to the Soda Light theme). Not sure what the difference is between the 'theme' and the 'color_scheme' is, but all that changed for me was the testing output coloring.

I had followed the instructions from #33 (comment) prior to doing this.

mps commented Jun 25, 2012

@mhartl your fix worked for me, thanks!

gs commented Jun 26, 2012

@pdtpatrick just remove "theme": "Nil.sublime-theme" from your config file... hope this solve issue
@adamwiggall 'theme' can style sublime, different menu colors, and so on...
'color_scheme' define colors in edit mode, highlights :)

Hope that give some hint.


ritchiey commented Jul 3, 2012

Thanks for that, @mhartl. Worked for me but I had to edit my .rspec file and remove the --tty to get rid of the ESC escape characters that were appearing in the output.


@adamwiggall Just change the Widget - Soda Light.sublime-settings file in Packages/Theme - Soda/Soda Light instead and you'll get both the Soda theme and the colored console.


@adamwiggall Doing what you did worked for me as well! Thanks!


And having tried ALL of the above fixes, I'd bet there's a conflict between several ways that a "widget" can be configured.


If you are using one of the soda themes, the rubytest results window (a ST widget) loses color - but if you copy the settings from RubyTest/widget.sublime-settings into (for example) Soda Dark/Widget - Soda Dark.sublime-settings you can have rspec color and Soda [Dark/light]

levity commented Jul 26, 2012

I copied RubyTest/Widget.sublime-settings into User/ and that worked for me, since I'm not using color for any other widgets.

dlucca commented Jul 31, 2012

@mediafinger comment six month ago solve it for me! I'm also using the Soda Theme thanks!!!

neocsr commented Aug 11, 2012

@levity copying Widget.sublime-settings into User also worked for me.

wanwu commented Aug 11, 2012

And am using Railcasts theme + Followed @mhartl's fix above.

Then I commented out Soda Light.sublime-theme in the config file:

 // "theme": "Soda Light.sublime-theme",

That got me the white on black test console & colors working for RubyTests.

fredwu commented Aug 16, 2012

If you're using a custom theme (such as Soda Light/Dark), make sure in Widget - name-of-your-them.sublime-settings you also have the following:

"syntax": "Packages/RubyTest/TestConsole.tmLanguage"
gja commented Aug 17, 2012

This should also get fixed if you merge in #99. I explicitly set the color theme.


I've tried all of these and I'm not getting color highlighting. I have ST version 201 build 2217. I'm using the Monokai theme.
My Widget.sublime-settings file looks like:


  "color_scheme": "Packages/RubyTest/TestConsole.tmTheme"

And my Preferences.sublime-settings looks like:

    "color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
    "font_size": 14.0,
    "syntax": "Packages/RubyTest/TestConsole.tmLanguage"

It'd be nice if I could get it to work!


Hi all,

Just getting my system set up today on Lesson 3 of the Rails Tutorial, and I couldn't get the custom colors to work either. I'm using build 2217 of Sublime Text 2, but when I followed the steps from @mhartl to swap in his CustomTestConsole.tmTheme, it didn't work. That is, I had the default colors (which render the failures as pink) but I wanted to get it to red as demonstrated in the screencasts. Worked on it for several hours and finally found a solution.

It turns out that, at least for me, that a file called was overwriting any changes I made to Theme - Default/Widget.sublime-settings.

So here's essentially what I did.

  1. Copy CustomTestConsole.tmTheme to ~/Library/Application Support/Sublime Text 2/Packages/RubyTest/CustomTestConsole.tmTheme.

  2. Edit so that all references to Packages/RubyTest/TestConsole.hidden-tmTheme are changed to Packages/RubyTest/CustomTestConsole.tmTheme.

Once I did this, it picked up the custom colors immediately. Didn't even have to restart Sublime. :) Hope that helps!


I realize I'm commenting to a closed case but I followed the workaround, and I'm closer, but still broken.

@mhartl's 'kludgy workaround' did give me colors (which I didn't have before..thanks!) but I'm still getting what looks like color escape codes showing up.

fyi I'm using build 2217 on a mac.

What I've done is edited the Theme - Default/Widget.sublime-settings to point to "Packages/RubyTest/TestConsole.hidden-tmTheme" (since that's the only tmTheme file)

Here's what I'm at:
Screen Shot 2012-12-16 at 11 15 52 AM


I got the same problem than @JohnMorales, got colors but still those horrible "ESC" characters too.


Actually just fixed the problem by editing my cucumber.yml so it doesn't print colors:

Change cucumber.yml from:
std_opts = "--strict --tags ~@wip"
std_opts = "--no-color --strict --tags ~@wip"

Now I have the colors working perfectly. It seems that maybe cucumber was adding colors and then RubyTest was adding colors again causing those ESC characters.

Jpunt commented Dec 30, 2012

I've made TestConsole.hidden-tmTheme comparable with Monokai and Espresso Soda, for those who can't stand differences between windows (like me):
Screen Shot 2012-12-30 at 12 37 10
Screen Shot 2012-12-30 at 12 37 44

@virtix virtix referenced this issue in mxunit/sublime-text-2-mxunit Jan 18, 2013

New Output View #4


I've tried all of the above workarounds, and none of them work for me. I'm using build 2220 on OS X Mountain Lion. These are tests running under Ruby/Rails/Zeus:


I had the same problem as JasonMorales and javiercr.

I'm using build 2217 on a linux (Ubuntu).

javiercr's solution works fine to me! Just change the color option on cucumber.yml to "no-color"

Thanks a lot. 👍

Before and after :-)


javiercr commented Apr 6, 2013

Glad it worked for you @karolxavierleite!

georgiee commented Jun 5, 2013

I had the same problem. RubyTest was not the problem, as it worked in the default setup without any rails preloader.
In my setup using "spin" to preload rails and speed up testing I got those escape sequences. It`s not spin to blame but it's a nice place to fix.
This following regex strips out ansi sequences and the output looks nice again. I think this problem could be solved inside RubyTest by running the regex in the python script executing the specs. Other preload scenarios (spork, zeus) could be fixed with this approach. Anyway here the regex and a link to my spin pull request.

Pull request: jstorimer/spin#80


output = output.gsub(/\e\[[^m]*m/, '')

Here my fixed output.
screen shot 2013-06-05 at 11 53 14

@dsandstrom dsandstrom referenced this issue in jfelchner/ruby-progressbar Jun 6, 2013

New line spam on Windows #29

gucki commented Jul 11, 2013

I'd also recommend to either support/ interpret ansi sequences or just strip them as @georgiee suggested. 👍


Ok. None of this worked for me. Out of nothing I got the black&white bug. This was driving me crazing, and I found that adding the following to my RubyTest.sublime-settings, solved me the problem.

"theme": "Packages/RubyTest/TestConsole.hidden-tmTheme"

Hope it works to others.


@imton high five!

Furthermore, swapping out the contents of Packages/RubyTest/TestConsole.hidden-tmTheme with CustomTestConsole.tmTheme replaces pink with red for failing tests.


Ok. I want to cry. Suddenly I've got the black/white problem again. my previous setting seems to be not working anymore. :(

So far the alternative I've found is to replace the "Theme - Default" setting to "Packages/RubyTest/TestConsole.hidden-tmTheme"

gs commented Jul 16, 2013

hey, we dont need any more hacking.

colors should be at place, check if you have path in your RubyTest.sublime-settings.

Also be sure to restart sublime few times..there might be caching problem :)

Good luck

ka8725 commented Jul 17, 2013

I had this issue with rspec. So my solution was do not use custom format option. I used to format option and it was the cause of the issue


@gs Colors seem to be working better, Thanks. However, a couple things don't seem to be working right.

If all tests past, the dots are green
screenshot from 2013-08-14 16 14 35

But if there is a fail, the dots turn white. The F is correctly pink, though.
screenshot from 2013-08-14 16 14 18

Also a pending, turns the dots white.
screenshot from 2013-08-14 16 15 31

I realize that these are just minor details, but just wanted you to know.

@laggingreflex laggingreflex referenced this issue in misfo/Shell-Turtlestein Aug 29, 2014

FR: Colors! #9


For get rid of ugly Esc characters(in rspec output), just remove --color from .rspec file.


This is still not working for me. Tried all the suggestions above but nothing seems to be working.

With Minitest Reporters On:
screen shot 2015-01-18 at 7 42 01 pm
screen shot 2015-01-18 at 7 41 21 pm

With Minitest Reporters Off:
screen shot 2015-01-18 at 7 42 45 pm
screen shot 2015-01-18 at 7 43 07 pm

Using Sublime Text 2 Build 2221 and Rails 4.2.0.

EDIT: I also don't know what you mean by "check if you have path in your RubyTest.sublime-settings." @gs :)


Hi, any solution for ST3? I tried but the issue is still there :(

And I cannot find Theme - Default/Widget.sublime-setting in Packages directory


javiercr's solution works fine to me! Just change the color option on cucumber.yml to "no-color"

Thanks a lot. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment