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:
Mark VanLandingham
2019-10-09 09:40:06 -05:00
committed by GitHub
parent 074ce70c28
commit 9b4aba0d39
2 changed files with 25 additions and 2 deletions

View File

@@ -1,12 +1,15 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
ENV['RAILS_ENV'] ||= 'test'
require './lib/turbo_tests'
require 'optparse'
requires = []
formatters = []
verbose = false
fail_fast = nil
OptionParser.new do |opts|
opts.on("-r", "--require PATH", "Require a file.") do |filename|
@@ -33,6 +36,12 @@ OptionParser.new do |opts|
opts.on("-v", "--verbose", "More output") do
verbose = true
end
opts.on("--fail-fast=[N]") do |n|
n = Integer(n) rescue nil
fail_fast = (n.nil? || n < 1) ? 1 : n
end
end.parse!(ARGV)
requires.each { |f| require(f) }
@@ -54,7 +63,8 @@ success =
TurboTests::Runner.run(
formatters: formatters,
files: ARGV.empty? ? ["spec"] : ARGV,
verbose: verbose
verbose: verbose,
fail_fast: fail_fast
)
if success