RSpec 二等分无限期运行

Igo*_*isk 2 rspec rspec-rails rspec3

这个问题与此不同:rspec Bisect Runs Indefinitely

\n\n

我的测试套件需要 \xc2\xb1 10 分钟才能运行。\n当我运行时bundle exec rspec --bisect=verbose,它卡住了 1 个多小时(这是我等待的最长时间):

\n\n
bundle exec rspec --bisect=verbose\nAssetSync: using /home/belasis/dev/deploy_webapp/config/initializers/asset_sync.rb\nBisect started using options: "" and bisect runner: :fork\nRunning suite to find failures...\n
Run Code Online (Sandbox Code Playgroud)\n\n

我点击后Ctrl C,出现此消息:

\n\n
Bisect aborted!\n\nThe most minimal reproduction command discovered so far is:\n  (Not yet enough information to provide any repro command)\n
Run Code Online (Sandbox Code Playgroud)\n\n

因此,问题在于它没有运行任何内容并且没有给出错误消息。这怎么可能?

\n

sen*_*nya 5

我遇到了这个问题,我通过 3 个操作解决了它。我认为这是最后一个有帮助的,但其他的在某些情况下也可能很重要:

  1. 更新rspec-core至3.9.1版本
  2. 使用DISABLE_SPRING=trueenv 变量运行二等分
  3. 使用shellbisect_runner 而不是默认fork

最后的更改是通过创建一个具有如下配置的本地文件来实现的:

RSpec.configure do |config|
  config.bisect_runner = :shell
end
Run Code Online (Sandbox Code Playgroud)

我们称其为罚款rsp_shell.rb并将其保存在项目根目录中。

然后你必须像这样运行 bisect :

bundle exec rspec --require './rsp_shell' --bisect=verbose ...other arguments...
Run Code Online (Sandbox Code Playgroud)

此外,将 require 参数放在命令中的 bisect 参数之前似乎也很重要。

rspec 输出中的以下字符串表明应用了最后一个设置:

and bisect runner: :shell
Run Code Online (Sandbox Code Playgroud)