Possible to “fail fast” when running rake test w/ minitest 5?

扶醉桌前 提交于 2020-01-03 15:31:24

问题


Is it possible to configure 'rake test' to stop running tests as soon as it hits a failure/exception?

My setup:

  • Rails 4.1
  • Minitest 5.3.4
  • Tapout (for formatting)

I'd like to start the test suite and immediately stop if a test fails -- the default behavior is to keep running all the tests which, in some cases, is too much data (especially one small bug causes a ton of tests to suddenly fail.)

I had a nice little setup going with the older version of Minitest (4.x) and the Turn gem by following this gist: (Add a simple fail-fast option to minitest/turn/minitest-rails), but I'm working on a new Rails 4.1 app right now and Turn isn't compatible with Minitest 5 (yet).

Any thoughts?


回答1:


If you are using Rails 5, try rails test -f will 'fail fast'. It means abort test run of first failure or error if you run rails test -h




回答2:


You can use this new gem with Rails 4.2 and and Minitest 5.6.1: minitest-fail-fast



来源:https://stackoverflow.com/questions/23773777/possible-to-fail-fast-when-running-rake-test-w-minitest-5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!