Cucumber: pipe output without losing color

余生长醉 提交于 2020-01-14 10:08:34

问题


I'm using cucumber to run some tests. It colorizes its output using ANSI escapes. This is great, but currently its producing more output than I care about, and shoving things I do care about off the screen. There doesn't seem to be a way to eliminate the other lines from within cucumber, but I can pipe the output through grep to pare down to the ones I care about.

The downside of this solution, though, is that all the colors are lost. I know it's not my shell or grep's fault, because % echo "\e[35mhello\e[00m world" | grep hello works just fine, so it must be cucumber disabling its own color somehow.

How can I preserve the colored output when I pipe the output of cucumber?


回答1:


Doh. It's covered in cucumber -h. Use the -c flag to force colorized output.



来源:https://stackoverflow.com/questions/3789739/cucumber-pipe-output-without-losing-color

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!