Cucumber: pipe output without losing color

2019-06-22 03:44发布

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条回答
Lonely孤独者°
2楼-- · 2019-06-22 04:38

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

查看更多
登录 后发表回答