You can clone with
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.
[34m[1m<true> [1m[7mexpected but was[0m[0m
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.
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"
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.
That looks good now!
Thanks for sorting this out.
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 http://cl.ly/ENTr. 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. http://cl.ly/EMra 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? http://cl.ly/ENEx
added colors for cucumber test output http://cl.ly/1H3F2a001J2c2z3H1j3k
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 - https://github.com/maltize/sublime-text-2-ruby-tests/pulls
I'm on Build 2181 and Coloring still does not work. I've tried all the solutions in here.
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",
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.
@mhartl your fix worked for me, thanks!
@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.
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]
I copied RubyTest/Widget.sublime-settings into User/ and that worked for me, since I'm not using color for any other widgets.
@mediafinger comment six month ago solve it for me! I'm also using the Soda Theme thanks!!!
@levity copying Widget.sublime-settings into User also worked for me.
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.
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:
Widget - name-of-your-them.sublime-settings
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:
And my Preferences.sublime-settings looks like:
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
It'd be nice if I could get it to work!
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 run_ruby_test.py was overwriting any changes I made to Theme - Default/Widget.sublime-settings.
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.
~/Library/Application Support/Sublime Text 2/Packages/RubyTest/CustomTestConsole.tmTheme
2) Edit run_ruby_test.py 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:
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"
tostd_opts = "--no-color --strict --tags ~@wip"
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.
I've made TestConsole.hidden-tmTheme comparable with Monokai and Espresso Soda, for those who can't stand differences between windows (like me):
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 :-)
Glad it worked for you @karolxavierleite!
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.
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.
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"
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 :)
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
But if there is a fail, the dots turn white. The F is correctly pink, though.
Also a pending, turns the dots white.
I realize that these are just minor details, but just wanted you to know.