mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
DEV: support --fail-fast in bin/turbo_rspec (#8170)
* [WIP] - default turbo spec env to test * FEATURE: support for --fast-fail in bin/turbo_rspec * fast-fail -> fail_fast to match rspec * Moved thread killing outside of fail-fast check * Removed failure_count incrementation from fast_fail_met
This commit is contained in:

committed by
GitHub

parent
074ce70c28
commit
9b4aba0d39
@ -7,6 +7,7 @@ module TurboTests
|
||||
formatters = opts[:formatters]
|
||||
start_time = opts.fetch(:start_time) { Time.now }
|
||||
verbose = opts.fetch(:verbose, false)
|
||||
fail_fast = opts.fetch(:fail_fast, nil)
|
||||
|
||||
if verbose
|
||||
STDERR.puts "VERBOSE"
|
||||
@ -17,7 +18,8 @@ module TurboTests
|
||||
new(
|
||||
reporter: reporter,
|
||||
files: files,
|
||||
verbose: verbose
|
||||
verbose: verbose,
|
||||
fail_fast: fail_fast
|
||||
).run
|
||||
end
|
||||
|
||||
@ -25,6 +27,8 @@ module TurboTests
|
||||
@reporter = opts[:reporter]
|
||||
@files = opts[:files]
|
||||
@verbose = opts[:verbose]
|
||||
@fail_fast = opts[:fail_fast]
|
||||
@failure_count = 0
|
||||
|
||||
@messages = Queue.new
|
||||
@threads = []
|
||||
@ -215,6 +219,11 @@ module TurboTests
|
||||
when 'example_failed'
|
||||
example = FakeExample.from_obj(message[:example])
|
||||
@reporter.example_failed(example)
|
||||
@failure_count += 1
|
||||
if fail_fast_met
|
||||
@threads.each(&:kill)
|
||||
break
|
||||
end
|
||||
when 'seed'
|
||||
when 'close'
|
||||
when 'exit'
|
||||
@ -231,5 +240,9 @@ module TurboTests
|
||||
rescue Interrupt
|
||||
end
|
||||
end
|
||||
|
||||
def fail_fast_met
|
||||
!@fail_fast.nil? && @fail_fast >= @failure_count
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user