Enhance cucumber coloring #50

merged 13 commits into from Feb 28, 2012

2 participants


Thanks for the last commit where you added a few colors!


It gave me a jumping off point and I added some custom regex matchers for the tmLanguage and tmTheme to more closely resemble the actual colored command line output.




However, I can't seem to get the 'dot matches newline' option (or any options) to work in a tmLanguage file. I'm trying to highlight all of the section between the "expected: blah" and the next step. I planned to build upon this and highlight the remaining (pending) steps after a failure and see if I could use some look-behind regex to highlight the green steps before a failure as well.

This was my attempt at highlighting the expected: block


I thought using this:


might work, but it doesn't match on newlines.

In fact, this (below) doesn't even work to highlight the rest of the output red (obviously we wouldn't want that ultimately, but I couldn't even get it to work):


I also tried:


as I'm not sure what the syntax actually is for specifying options in a regex of a tmlanguage file. I couldn't find a clear example.

Would love to hear your thoughts!

Thanks much,


Since my original comment I've made some significant enhancements after discovering Textmate's "begin" and "end" capture matching capabilities to grab a section of text between two matches. There's also "beginCapture" and "endCapture" to help style the initial line you match on.

Here is a screenshot of a passing cuke (comparing it to the cucumber output in iTerm 2):


Here is one with an error step and a pending step:


So as you can see... there are a few things I can't work out. I'm worried that they might just not be technically possible with how we're limited inside the RubyTest console widget with the regex capabilities of the tmLanguage that defines that view. Namely, steps that have either failed or are pending are colored in green. This was the lesser of two evils IMHO because if I didn't style them green then there would be no way to show a green passing step ever.

Also, undefined steps can't really be targeted with regex (at least I can't see how)... so they show up as green too :( And of couse if you don't know it's an undefined step then there isn't a way to show that the ones after it were skipped... so they all show green as well.


All and all I think this is better than not having any coloring. It's pretty close and just requires that you pay attention to what the bottom says for 'failed, skipped, pending, undefined, passed'.

However, if there is a way to fix any of the above I'd be happy to get some help on this!

@gs gs merged commit 9d9fa5a into maltize:master Feb 28, 2012
gs commented Feb 28, 2012


Thanks for nice update and your effort.

I will try to look into it and maybe we will figure out the solution.



Hi Grzegorz!

You're welcome, I'm happy to help. Thanks to you for looking into the remaining issues. Hopefully you or someone can find a way to fix up the erroneous passing step coloration during a failure or pending. It'd be easier if we could use some code to count the number of steps before the 'error' or 'pending' text, but I'm not sure how we'd do that. Or if we could hijack the cucumber command line output before it hits the RubyTest console and inject some special characters on a failing step that we could more easily match on to color those lines.


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