让 RSpec 报告中间故障 [英] Getting RSpec to report intermediate failures

查看:37
本文介绍了让 RSpec 报告中间故障的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法让 RSpec 在发生故障时报告故障,而不是一长串绿/红点?我正在运行 RSpec 2.5.0.

Is there a way to get RSpec to report failures as they occur, instead of the long list of green/red dots? I'm running RSpec 2.5.0.

推荐答案

RSpec 支持多种输出格式,使用 --format 选项指定.默认值为progress",即您看到的点串.如果您更改为更详细的格式,您将在运行时看到红色/绿色的测试名称,但在最后打印的摘要之前,您仍然不会看到失败的原因.

RSpec supports multiple output formats, specified with the --format option. The default is "progress", the string of dots you're seeing. If you change to a more verbose format, you'll see the name of the test in red/green as you run, but you still won't see what the failure was until the summary that's printed at the end.

运行 rspec --help 的其他格式选项是:

The other format options, from running rspec --help are:

-f, --format FORMATTER           Choose a formatter
                                   [p]rogress (default - dots)
                                   [d]ocumentation (group and example names)
                                   [h]tml
                                   [t]extmate
                                   custom formatter class name

除了在命令行中指定格式之外,您还可以在主目录中放置一个.rspec"文件来指定默认选项.

In addition to specifying format on the command line, you can put a ".rspec" file in your home directory to specify default options.

这篇关于让 RSpec 报告中间故障的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆