问题
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