1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

modify to error also abort when specify fail fast option

This commit is contained in:
yuuji.yaginuma 2016-02-15 17:01:29 +09:00
parent c60fb74dc6
commit 1b8fc04216
4 changed files with 20 additions and 5 deletions

View file

@ -1,3 +1,7 @@
* Change fail fast of `bin/rails test` interrupts run on error.
*Yuji Yaginuma*
* The application generator supports `--skip-listen` to opt-out of features
that depend on the listen gem. As of this writing they are the evented file
system monitor and the async plugin for spring.

View file

@ -42,7 +42,7 @@ module Minitest
end
opts.on("-f", "--fail-fast",
"Abort test run on first failure") do
"Abort test run on first failure or error") do
options[:fail_fast] = true
end

View file

@ -24,7 +24,7 @@ module Rails
io.puts
end
if fail_fast? && result.failure && !result.error? && !result.skipped?
if fail_fast? && result.failure && !result.skipped?
raise Interrupt
end
end

View file

@ -104,11 +104,22 @@ class TestUnitReporterTest < ActiveSupport::TestCase
end
end
test "fail fast does not interrupt run errors or skips" do
test "fail fast interrupts run on error" do
fail_fast = Rails::TestUnitReporter.new @output, fail_fast: true
interrupt_raised = false
fail_fast.record(errored_test)
assert_no_match 'Failed tests:', @output.string
# Minitest passes through Interrupt, catch it manually.
begin
fail_fast.record(errored_test)
rescue Interrupt
interrupt_raised = true
ensure
assert interrupt_raised, 'Expected Interrupt to be raised.'
end
end
test "fail fast does not interrupt run skips" do
fail_fast = Rails::TestUnitReporter.new @output, fail_fast: true
fail_fast.record(skipped_test)
assert_no_match 'Failed tests:', @output.string