使用 JRuby 或包执行时如何使用 rspec 启用颜色?
我正在尝试使用 JRuby 运行我的 rspec:
rake spec
结果是:
jruby -S bundle exec rspec --color spec/foo_spec.rb
没有显示颜色,所以我从等式中删除了 Jruby:
bundle exec rspec --color spec/foo_spec.rb
没有颜色。如何将“--color”选项传递给 rspec?我的项目的根目录中还有一个 .rspec 文件,这在这些情况下似乎没有帮助。但是,当我刚刚运行时,.rspec 文件被拾取或使用:
rspec spec/foo_spec.rb
有什么想法吗?
I'm trying to run my rspec's with JRuby:
rake spec
which results in:
jruby -S bundle exec rspec --color spec/foo_spec.rb
No colors show up, so I removed Jruby from the equation:
bundle exec rspec --color spec/foo_spec.rb
no colors. How can I get the "--color" option passed through to rspec? I've also got a .rspec file in the root directory of my project which doesn't seem to help in these cases. However, the .rspec file is picked-up or used when I just run:
rspec spec/foo_spec.rb
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将
--tty
添加到调用中可以解决我的问题:该选项告诉 RSpec 输出不会写入文件(在这种情况下您不需要彩色输出),而是发送到另一个文件而是处理。
Adding
--tty
to the call fixes the problem for me:The option tells RSpec that the output is not written to a file (in which case you wouldn't want colorized output), but send to another process instead.