Remove warning about ansicon from "rake cucumber"
When 开发者_如何学Cyou run any rake task with cucumber installed on a machine that doesn't have ANSICON installed, you get the following message:
*** WARNING: You must use ANSICON 1.31 or higher (http://adoxa.110mb.com/ansicon) to get coloured output on Windows
When running locally I like using ANSICON, but when used within the build server I don't care about that - and I don't want to see that warning there. Is there a way to get rid of it?
You can actually remove the warning itself. I do not like installing a bunch of garbage just for the sake of having a green word. So, to remove the warning:
1. Locate the Cucumber installation in gems directory (it's in the Ruby installation directory). For me it was: lib\ruby\gems\1.9.1\gems\cucumber-1.2.0
2. In the cucumber-1.2.0\lib\cucumber\formatter directory of the Cucumber installation find the file ansicolor.rb
3. Locate the line:
STDERR.puts %{*** WARNING: You must use ANSICON 1.31 or higher (http://adoxa.110mb.com/ansicon) to get coloured output on Windows}
and add # in front of it to comment it out:
# STDERR.puts %{*** WARNING: You must use ANSICON 1.31 or higher (http://adoxa.110mb.com/ansicon) to get coloured output on Windows}
The line number was 14 for my version of Cucumber.
4. Save the file and you're done
- Download and unzip the file from http://adoxa.altervista.org/ansicon/
- open cmd and navigate to the unzipped folder
- Navigate to x64 (if you have a 64 bit machine) otherwise navigate to x86
- Type ansicon.exe -h and you will get help of this command
- Execute 'ansicon.exe -i' to install and add ansicon to your Windows
- Run your cucumber 0.10.0 test and you should get the coloured output result on Windows
Can you add an exception to you spec_helper.rb? Or perhaps try adding a tag which you filter on when using rake?
精彩评论