gpt4 book ai didi

ruby - 使用 --out 时如何摆脱添加到 rspec 的持续时间?

转载 作者:数据小太阳 更新时间:2023-10-29 08:44:35 25 4
gpt4 key购买 nike

当我使用 rspec --format documentation 到 stdout 时,我得到如下信息:

User adds a third site and successfully credentials PayPal on FEB-17-2015
Invoices the customer with a pro-rated Pro plan for the 3 unused days credited (PENDING: Not yet implemented)

这是期望的行为。

但是,当我使用 rspec --format documentation --out spec.txt 时,我得到了这个:

User adds a third site and successfully credentials PayPal on FEB-17-2015
[33m Invoices the customer with a pro-rated Pro plan for the 3 unused days credited (PENDING: Not yet implemented)[0m

格式现在不可读,因为在一侧添加了 [33m,在另一侧添加了 [0m

上述行为与文档中描述的示例背道而驰:

https://www.relishapp.com/rspec/rspec-core/v/2-4/docs/command-line/format-option#documentation-format-saved-to-a-file

问题:如何使文本匹配所需的标准输出?

最佳答案

[33m 不是持续时间;这是一个ANSI color code这就是 RSpec 以彩色打印其输出的方式。 RSpec 旨在感知输出不会发送到 TTY 并在这种情况下禁用颜色,但它似乎不起作用。不过,您可以通过 --no-color 手动禁用它。

关于ruby - 使用 --out 时如何摆脱添加到 rspec 的持续时间?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33616760/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com