From 6634d2554e56d8382bb2669a568d61567c488bcc Mon Sep 17 00:00:00 2001 From: Dana Scheider Date: Sat, 8 Aug 2015 18:35:02 -0700 Subject: [PATCH 01/11] Fail fast feature --- features/docs/cli/fail_fast.feature | 45 +++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 features/docs/cli/fail_fast.feature diff --git a/features/docs/cli/fail_fast.feature b/features/docs/cli/fail_fast.feature new file mode 100644 index 0000000000..d16512e2ee --- /dev/null +++ b/features/docs/cli/fail_fast.feature @@ -0,0 +1,45 @@ +Feature: Fail fast + + The --fail-fast flag causes Cucumber to exit immediately after the first + scenario fails. + + Scenario: When a scenario fails + Given a file named "features/bad.feature" with: + """ + Feature: Bad + Scenario: Failing + Given this step fails + """ + And a file named "features/good.feature" with: + """ + Feature: Good + Scenario: Passing + Given this step passes + """ + And the standard step definitions + When I run `cucumber --fail-fast` + Then it should fail + And the output should contain: + """ + 1 scenario (1 failed) + """ + + Scenario: When all the scenarios pass + Given a file named "features/first.feature" with: + """ + Feature: first feature + Scenario: foo first + Given this step passes + Scenario: bar first + Given this step passes + """ + And a file named "features/second.feature" with: + """ + Feature: second + Scenario: foo second + Given this step passes + Scenario: bar second + Given this step passes + """ + When I run `cucumber --fail-fast` + Then it should pass \ No newline at end of file From f25374581b1cdb01a9b7c58624215243654c7ee9 Mon Sep 17 00:00:00 2001 From: Dana Scheider Date: Sat, 8 Aug 2015 18:42:15 -0700 Subject: [PATCH 02/11] Revert "Fail fast feature" This reverts commit 6634d2554e56d8382bb2669a568d61567c488bcc. --- features/docs/cli/fail_fast.feature | 45 ----------------------------- 1 file changed, 45 deletions(-) delete mode 100644 features/docs/cli/fail_fast.feature diff --git a/features/docs/cli/fail_fast.feature b/features/docs/cli/fail_fast.feature deleted file mode 100644 index d16512e2ee..0000000000 --- a/features/docs/cli/fail_fast.feature +++ /dev/null @@ -1,45 +0,0 @@ -Feature: Fail fast - - The --fail-fast flag causes Cucumber to exit immediately after the first - scenario fails. - - Scenario: When a scenario fails - Given a file named "features/bad.feature" with: - """ - Feature: Bad - Scenario: Failing - Given this step fails - """ - And a file named "features/good.feature" with: - """ - Feature: Good - Scenario: Passing - Given this step passes - """ - And the standard step definitions - When I run `cucumber --fail-fast` - Then it should fail - And the output should contain: - """ - 1 scenario (1 failed) - """ - - Scenario: When all the scenarios pass - Given a file named "features/first.feature" with: - """ - Feature: first feature - Scenario: foo first - Given this step passes - Scenario: bar first - Given this step passes - """ - And a file named "features/second.feature" with: - """ - Feature: second - Scenario: foo second - Given this step passes - Scenario: bar second - Given this step passes - """ - When I run `cucumber --fail-fast` - Then it should pass \ No newline at end of file From ff6891b166ad8bae1eb2b2de10abd74c9a3eba8b Mon Sep 17 00:00:00 2001 From: Dana Scheider Date: Sat, 8 Aug 2015 18:52:10 -0700 Subject: [PATCH 03/11] Set Travis to run builds against the current branch --- .travis.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4ef373393a..aaa037c737 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,9 +10,4 @@ branches: only: - master - v1.3.x-bugfix - -notifications: - email: - - cukes-devs@googlegroups.com - irc: - - "irc.freenode.org#cucumber" + - add-fail-fast-switch From 5ffdb6cc30b09a37f7632293826ab15716100f5f Mon Sep 17 00:00:00 2001 From: Dana Scheider Date: Sat, 8 Aug 2015 18:55:25 -0700 Subject: [PATCH 04/11] Initial feature for fail-fast switch --- features/docs/cli/fail_fast.feature | 45 +++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 features/docs/cli/fail_fast.feature diff --git a/features/docs/cli/fail_fast.feature b/features/docs/cli/fail_fast.feature new file mode 100644 index 0000000000..d16512e2ee --- /dev/null +++ b/features/docs/cli/fail_fast.feature @@ -0,0 +1,45 @@ +Feature: Fail fast + + The --fail-fast flag causes Cucumber to exit immediately after the first + scenario fails. + + Scenario: When a scenario fails + Given a file named "features/bad.feature" with: + """ + Feature: Bad + Scenario: Failing + Given this step fails + """ + And a file named "features/good.feature" with: + """ + Feature: Good + Scenario: Passing + Given this step passes + """ + And the standard step definitions + When I run `cucumber --fail-fast` + Then it should fail + And the output should contain: + """ + 1 scenario (1 failed) + """ + + Scenario: When all the scenarios pass + Given a file named "features/first.feature" with: + """ + Feature: first feature + Scenario: foo first + Given this step passes + Scenario: bar first + Given this step passes + """ + And a file named "features/second.feature" with: + """ + Feature: second + Scenario: foo second + Given this step passes + Scenario: bar second + Given this step passes + """ + When I run `cucumber --fail-fast` + Then it should pass \ No newline at end of file From a08bff49e9e6b8265fa8599a4c9ccb3ae93059b6 Mon Sep 17 00:00:00 2001 From: Dana Scheider Date: Sat, 8 Aug 2015 19:13:11 -0700 Subject: [PATCH 05/11] Initial fail_fast formatter spec and file --- lib/cucumber/formatter/fail_fast.rb | 6 ++ spec/cucumber/formatter/fail_fast_spec.rb | 100 ++++++++++++++++++++++ 2 files changed, 106 insertions(+) create mode 100644 lib/cucumber/formatter/fail_fast.rb create mode 100644 spec/cucumber/formatter/fail_fast_spec.rb diff --git a/lib/cucumber/formatter/fail_fast.rb b/lib/cucumber/formatter/fail_fast.rb new file mode 100644 index 0000000000..a273770b71 --- /dev/null +++ b/lib/cucumber/formatter/fail_fast.rb @@ -0,0 +1,6 @@ +module Cucumber + module Formatter + class FailFast + end + end +end \ No newline at end of file diff --git a/spec/cucumber/formatter/fail_fast_spec.rb b/spec/cucumber/formatter/fail_fast_spec.rb new file mode 100644 index 0000000000..467d9576d1 --- /dev/null +++ b/spec/cucumber/formatter/fail_fast_spec.rb @@ -0,0 +1,100 @@ +require 'cucumber/formatter/fail_fast' +require 'cucumber/core' +require 'cucumber/core/gherkin/writer' +require 'cucumber/core/test/result' +require 'cucumber/core/filter' +require 'cucumber/core/ast' +require 'cucumber' + +module Cucumber::Formatter + describe FailFast do + include Cucumber::Core + include Cucumber::Core::Gherkin::Writer + + class WithStepsFake < Cucumber::Core::Filter.new + def test_case(test_case) + test_steps = test_case.test_steps.map do |step| + case step.name + when /fail/ + step.with_action { raise Failure } + when /pass/ + step.with_action {} + else + step + end + end + + test_case.with_steps(test_steps).describe_to(receiver) + end + end + + let(:report) { FailFast.new(double.as_null_object) } + + context 'failing scenario' do + before(:each) do + @gherkin = gherkin('foo.feature') do + feature do + scenario do + step 'failing' + end + + scenario do + step 'failing' + end + end + end + end + + after(:each) do + Cucumber.wants_to_quit = false + end + + it 'sets Cucumber.wants_to_quit' do + execute([@gherkin], report, [WithStepsFake.new]) + expect(Cucumber.wants_to_quit).to be true + end + end + + context 'passing scenario' do + before(:each) do + @gherkin = gherkin('foo.feature') do + feature do + scenario do + step 'passing' + end + end + end + end + + it 'doesn\'t set Cucumber.wants_to_quit' do + execute([@gherkin], report, [WithStepsFake.new]) + expect(Cucumber.wants_to_quit).to be_falsey + end + end + + describe 'after_test_case method' do + context 'failing scenario' do + it 'sets Cucumber.wants_to_quit' do + result = Cucumber::Core::Test::Result::Failed.new(double('duration'), double('exception')) + + test_case = double('test_case') + allow(test_case).to receive(:location) { Cucumber::Core::Ast::Location.new('foo.feature')} + report.after_test_case(test_case, result) + expect(Cucumber.wants_to_quit).to be true + end + end + + context 'passing scenario' do + let(:result) { Cucumber::Core::Test::Result::Passed.new(double) } + + it 'doesn\'t raise an error' do + expect{ report.after_test_case(double, result) }.not_to raise_error + end + + it 'returns nil' do + expect(report.after_test_case(double, result)).to eql nil + end + end + end + end +end \ No newline at end of file From 1ba97c9ddbaada4d9a98e0ce24b243341c2ffeff Mon Sep 17 00:00:00 2001 From: Dana Scheider Date: Sat, 8 Aug 2015 19:26:54 -0700 Subject: [PATCH 06/11] Add more fail-fast related changes --- lib/cucumber/cli/configuration.rb | 95 +++++++++++++++++++++++++++-- lib/cucumber/cli/main.rb | 2 +- lib/cucumber/cli/options.rb | 14 ++--- lib/cucumber/formatter/fail_fast.rb | 15 +++++ lib/cucumber/runtime.rb | 15 +++-- 5 files changed, 125 insertions(+), 16 deletions(-) diff --git a/lib/cucumber/cli/configuration.rb b/lib/cucumber/cli/configuration.rb index 1a2111834c..4d0f2b871e 100644 --- a/lib/cucumber/cli/configuration.rb +++ b/lib/cucumber/cli/configuration.rb @@ -1,6 +1,5 @@ require 'logger' require 'cucumber/cli/options' -require 'cucumber/cli/rerun_file' require 'cucumber/constantize' require 'gherkin/tag_expression' @@ -63,10 +62,69 @@ def expand? @options[:expand] end + def fail_fast? + !!@options[:fail_fast] + end + def snippet_type @options[:snippet_type] || :regexp end + def formatter_class(format) + if(builtin = Options::BUILTIN_FORMATS[format]) + constantize(builtin[0]) + else + constantize(format) + end + end + + def all_files_to_load + files = require_dirs.map do |path| + path = path.gsub(/\\/, '/') # In case we're on windows. Globs don't work with backslashes. + path = path.gsub(/\/$/, '') # Strip trailing slash. + File.directory?(path) ? Dir["#{path}/**/*"] : path + end.flatten.uniq + remove_excluded_files_from(files) + files.reject! {|f| !File.file?(f)} + files.reject! {|f| File.extname(f) == '.feature' } + files.reject! {|f| f =~ /^http/} + files.sort + end + + def step_defs_to_load + all_files_to_load.reject {|f| f =~ %r{/support/} } + end + + def support_to_load + support_files = all_files_to_load.select {|f| f =~ %r{/support/} } + env_files = support_files.select {|f| f =~ %r{/support/env\..*} } + other_files = support_files - env_files + @options[:dry_run] ? other_files : env_files + other_files + end + + def feature_files + potential_feature_files = with_default_features_path(paths).map do |path| + path = path.gsub(/\\/, '/') # In case we're on windows. Globs don't work with backslashes. + path = path.chomp('/') + if File.directory?(path) + Dir["#{path}/**/*.feature"].sort + elsif path[0..0] == '@' and # @listfile.txt + File.file?(path[1..-1]) # listfile.txt is a file + IO.read(path[1..-1]).split(/(.*?\.feature.*?) /).collect(&:strip).reject(&:empty?) + else + path + end + end.flatten.uniq + remove_excluded_files_from(potential_feature_files) + potential_feature_files + end + + def feature_dirs + dirs = paths.map { |f| File.directory?(f) ? f : File.dirname(f) }.uniq + dirs.delete('.') unless paths.include?('.') + with_default_features_path(dirs) + end + def log logger = Logger.new(@out_stream) logger.formatter = LogFormatter.new @@ -109,12 +167,31 @@ def paths @options[:paths] end - def to_hash - Hash.try_convert(@options).merge(out_stream: @out_stream, error_stream: @error_stream) + def formatter_factories + @options[:formats].map do |format_and_out| + format = format_and_out[0] + path_or_io = format_and_out[1] + begin + factory = formatter_class(format) + yield factory, path_or_io, @options + rescue Exception => e + e.message << "\nError creating formatter: #{format}" + raise e + end + end end private + def default_features_paths + ["features"] + end + + def with_default_features_path(paths) + return default_features_paths if paths.empty? + paths + end + class LogFormatter < ::Logger::Formatter def call(severity, time, progname, msg) msg @@ -134,7 +211,17 @@ def arrange_formats @options.check_formatter_stream_conflicts() end + def remove_excluded_files_from(files) + files.reject! {|path| @options[:excludes].detect {|pattern| path =~ pattern } } + end + def require_dirs + if @options[:require].empty? + default_features_paths + Dir['vendor/{gems,plugins}/*/cucumber'] + else + @options[:require] + end + end end end -end +end \ No newline at end of file diff --git a/lib/cucumber/cli/main.rb b/lib/cucumber/cli/main.rb index 924d5fcfca..c4f8607fd3 100644 --- a/lib/cucumber/cli/main.rb +++ b/lib/cucumber/cli/main.rb @@ -102,4 +102,4 @@ def trap_interrupt end end end -end +end \ No newline at end of file diff --git a/lib/cucumber/cli/options.rb b/lib/cucumber/cli/options.rb index 3e0abef900..242df83755 100644 --- a/lib/cucumber/cli/options.rb +++ b/lib/cucumber/cli/options.rb @@ -43,6 +43,7 @@ class Options NO_PROFILE_SHORT_FLAG = '-P' PROFILE_LONG_FLAG = '--profile' NO_PROFILE_LONG_FLAG = '--no-profile' + FAIL_FAST_FLAG = '--fail-fast' OPTIONS_WITH_ARGS = ['-r', '--require', '--i18n', '-f', '--format', '-o', '--out', '-t', '--tags', '-n', '--name', '-e', '--exclude', PROFILE_SHORT_FLAG, PROFILE_LONG_FLAG, @@ -59,9 +60,9 @@ def initialize(out_stream = STDOUT, error_stream = STDERR, options = {}) @error_stream = error_stream @default_profile = options[:default_profile] - @profiles = options[:profiles] || [] + @profiles = [] @overridden_paths = [] - @options = default_options.merge(options) + @options = default_options @profile_loader = options[:profile_loader] @options[:skip_profile_information] = options[:skip_profile_information] @@ -126,6 +127,9 @@ def parse!(args) list_keywords_and_exit(lang) end end + opts.on(FAIL_FAST_FLAG, "Exit immediately following the first failing scenario") do |v| + options[:fail_fast] = true + end opts.on("-f FORMAT", "--format FORMAT", "How to format features (Default: pretty). Available formats:", *FORMAT_HELP) do |v| @@ -289,10 +293,6 @@ def check_formatter_stream_conflicts() end end - def to_hash - Hash.try_convert(@options) - end - protected attr_reader :options, :profiles, :expanded_args @@ -425,4 +425,4 @@ def default_options end end -end +end \ No newline at end of file diff --git a/lib/cucumber/formatter/fail_fast.rb b/lib/cucumber/formatter/fail_fast.rb index a273770b71..5a29d8d97d 100644 --- a/lib/cucumber/formatter/fail_fast.rb +++ b/lib/cucumber/formatter/fail_fast.rb @@ -1,6 +1,21 @@ +require 'cucumber/formatter/io' +require 'cucumber/formatter/console' + module Cucumber module Formatter class FailFast + def initialize(configuration) + @configuration = configuration + end + + def after_test_case(test_case, result) + Cucumber.wants_to_quit = true unless result.ok? @configuration.strict? + end + + def done; end + def before_test_case *args; end + def before_test_step *args; end + def after_test_step *args; end end end end \ No newline at end of file diff --git a/lib/cucumber/runtime.rb b/lib/cucumber/runtime.rb index 4d9b5d95e0..87058d87e5 100644 --- a/lib/cucumber/runtime.rb +++ b/lib/cucumber/runtime.rb @@ -46,14 +46,14 @@ class Runtime include Runtime::UserInterface def initialize(configuration = Configuration.default) - @configuration = Configuration.new(configuration) + @configuration = Configuration.parse(configuration) @support_code = SupportCode.new(self, @configuration) @results = Formatter::LegacyApi::Results.new end # Allows you to take an existing runtime and change its configuration def configure(new_configuration) - @configuration = Configuration.new(new_configuration) + @configuration = Configuration.parse(new_configuration) @support_code.configure(@configuration) end @@ -180,9 +180,12 @@ def set_encoding require 'cucumber/formatter/legacy_api/runtime_facade' require 'cucumber/formatter/legacy_api/results' require 'cucumber/formatter/ignore_missing_messages' + require 'cucumber/formatter/fail_fast' require 'cucumber/core/report/summary' def report - @report ||= Formatter::Fanout.new([summary_report] + formatters) + args = [summary_report] + formatters + args << fail_fast_report if @configuration.fail_fast? + @report ||= Formatter::Fanout.new(args) end def summary_report @@ -200,6 +203,10 @@ def formatters } end + def fail_fast_report + @fail_fast_report ||= Formatter::FailFast.new configuration + end + def failure? if @configuration.wip? summary_report.test_cases.total_passed > 0 @@ -248,4 +255,4 @@ def log end -end +end \ No newline at end of file From 748ce3b163deb80e345e8c771e380d89472afca8 Mon Sep 17 00:00:00 2001 From: Dana Scheider Date: Sat, 8 Aug 2015 19:31:42 -0700 Subject: [PATCH 07/11] Define action for --fail-fast flag --- lib/cucumber/cli/options.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/cucumber/cli/options.rb b/lib/cucumber/cli/options.rb index 242df83755..77ddce10dc 100644 --- a/lib/cucumber/cli/options.rb +++ b/lib/cucumber/cli/options.rb @@ -167,6 +167,9 @@ def parse!(args) "This can be practical if you are practicing Kanban or CONWIP.") do |v| @options[:tag_expressions] << v end + opts.on("--fail-fast", "Cause Cucumber to exit after first failing scenario") do |v| + @options[:fail_fast] = true + end opts.on("-n NAME", "--name NAME", "Only execute the feature elements which match part of the given name.", "If this option is given more than once, it will match against all the", From 0949c55963cfd06b22eef35a936da4d5a43945d0 Mon Sep 17 00:00:00 2001 From: Dana Scheider Date: Sat, 8 Aug 2015 19:45:50 -0700 Subject: [PATCH 08/11] Modify the files I changed to be in line with changes made in upstream master --- lib/cucumber/cli/configuration.rb | 83 ++----------------------------- lib/cucumber/cli/options.rb | 8 ++- lib/cucumber/runtime.rb | 4 +- 3 files changed, 11 insertions(+), 84 deletions(-) diff --git a/lib/cucumber/cli/configuration.rb b/lib/cucumber/cli/configuration.rb index 4d0f2b871e..bc0a4b6492 100644 --- a/lib/cucumber/cli/configuration.rb +++ b/lib/cucumber/cli/configuration.rb @@ -1,5 +1,6 @@ require 'logger' require 'cucumber/cli/options' +require 'cucumber/cli/rerun_file' require 'cucumber/constantize' require 'gherkin/tag_expression' @@ -78,53 +79,6 @@ def formatter_class(format) end end - def all_files_to_load - files = require_dirs.map do |path| - path = path.gsub(/\\/, '/') # In case we're on windows. Globs don't work with backslashes. - path = path.gsub(/\/$/, '') # Strip trailing slash. - File.directory?(path) ? Dir["#{path}/**/*"] : path - end.flatten.uniq - remove_excluded_files_from(files) - files.reject! {|f| !File.file?(f)} - files.reject! {|f| File.extname(f) == '.feature' } - files.reject! {|f| f =~ /^http/} - files.sort - end - - def step_defs_to_load - all_files_to_load.reject {|f| f =~ %r{/support/} } - end - - def support_to_load - support_files = all_files_to_load.select {|f| f =~ %r{/support/} } - env_files = support_files.select {|f| f =~ %r{/support/env\..*} } - other_files = support_files - env_files - @options[:dry_run] ? other_files : env_files + other_files - end - - def feature_files - potential_feature_files = with_default_features_path(paths).map do |path| - path = path.gsub(/\\/, '/') # In case we're on windows. Globs don't work with backslashes. - path = path.chomp('/') - if File.directory?(path) - Dir["#{path}/**/*.feature"].sort - elsif path[0..0] == '@' and # @listfile.txt - File.file?(path[1..-1]) # listfile.txt is a file - IO.read(path[1..-1]).split(/(.*?\.feature.*?) /).collect(&:strip).reject(&:empty?) - else - path - end - end.flatten.uniq - remove_excluded_files_from(potential_feature_files) - potential_feature_files - end - - def feature_dirs - dirs = paths.map { |f| File.directory?(f) ? f : File.dirname(f) }.uniq - dirs.delete('.') unless paths.include?('.') - with_default_features_path(dirs) - end - def log logger = Logger.new(@out_stream) logger.formatter = LogFormatter.new @@ -167,31 +121,12 @@ def paths @options[:paths] end - def formatter_factories - @options[:formats].map do |format_and_out| - format = format_and_out[0] - path_or_io = format_and_out[1] - begin - factory = formatter_class(format) - yield factory, path_or_io, @options - rescue Exception => e - e.message << "\nError creating formatter: #{format}" - raise e - end - end + def to_hash + Hash.try_convert(@options).merge(out_stream: @out_stream, error_stream: @error_stream) end private - def default_features_paths - ["features"] - end - - def with_default_features_path(paths) - return default_features_paths if paths.empty? - paths - end - class LogFormatter < ::Logger::Formatter def call(severity, time, progname, msg) msg @@ -210,18 +145,6 @@ def arrange_formats @options[:formats].uniq! @options.check_formatter_stream_conflicts() end - - def remove_excluded_files_from(files) - files.reject! {|path| @options[:excludes].detect {|pattern| path =~ pattern } } - end - - def require_dirs - if @options[:require].empty? - default_features_paths + Dir['vendor/{gems,plugins}/*/cucumber'] - else - @options[:require] - end - end end end end \ No newline at end of file diff --git a/lib/cucumber/cli/options.rb b/lib/cucumber/cli/options.rb index 77ddce10dc..6492081cdb 100644 --- a/lib/cucumber/cli/options.rb +++ b/lib/cucumber/cli/options.rb @@ -60,9 +60,9 @@ def initialize(out_stream = STDOUT, error_stream = STDERR, options = {}) @error_stream = error_stream @default_profile = options[:default_profile] - @profiles = [] + @profiles = options[:profiles] || [] @overridden_paths = [] - @options = default_options + @options = default_options.merge(options) @profile_loader = options[:profile_loader] @options[:skip_profile_information] = options[:skip_profile_information] @@ -296,6 +296,10 @@ def check_formatter_stream_conflicts() end end + def to_hash + Hash.try_convert(@options) + end + protected attr_reader :options, :profiles, :expanded_args diff --git a/lib/cucumber/runtime.rb b/lib/cucumber/runtime.rb index 87058d87e5..1bf1d3c87f 100644 --- a/lib/cucumber/runtime.rb +++ b/lib/cucumber/runtime.rb @@ -46,14 +46,14 @@ class Runtime include Runtime::UserInterface def initialize(configuration = Configuration.default) - @configuration = Configuration.parse(configuration) + @configuration = Configuration.new(configuration) @support_code = SupportCode.new(self, @configuration) @results = Formatter::LegacyApi::Results.new end # Allows you to take an existing runtime and change its configuration def configure(new_configuration) - @configuration = Configuration.parse(new_configuration) + @configuration = Configuration.new(new_configuration) @support_code.configure(@configuration) end From 65dca2144ce1991a9e2e32d23696b070dbf216b0 Mon Sep 17 00:00:00 2001 From: Dana Scheider Date: Sat, 8 Aug 2015 19:49:03 -0700 Subject: [PATCH 09/11] Make additional changes to line up with upstream changes --- lib/cucumber/cli/configuration.rb | 8 -------- lib/cucumber/cli/options.rb | 3 --- 2 files changed, 11 deletions(-) diff --git a/lib/cucumber/cli/configuration.rb b/lib/cucumber/cli/configuration.rb index bc0a4b6492..4b011ba191 100644 --- a/lib/cucumber/cli/configuration.rb +++ b/lib/cucumber/cli/configuration.rb @@ -71,14 +71,6 @@ def snippet_type @options[:snippet_type] || :regexp end - def formatter_class(format) - if(builtin = Options::BUILTIN_FORMATS[format]) - constantize(builtin[0]) - else - constantize(format) - end - end - def log logger = Logger.new(@out_stream) logger.formatter = LogFormatter.new diff --git a/lib/cucumber/cli/options.rb b/lib/cucumber/cli/options.rb index 6492081cdb..9cae5ac623 100644 --- a/lib/cucumber/cli/options.rb +++ b/lib/cucumber/cli/options.rb @@ -167,9 +167,6 @@ def parse!(args) "This can be practical if you are practicing Kanban or CONWIP.") do |v| @options[:tag_expressions] << v end - opts.on("--fail-fast", "Cause Cucumber to exit after first failing scenario") do |v| - @options[:fail_fast] = true - end opts.on("-n NAME", "--name NAME", "Only execute the feature elements which match part of the given name.", "If this option is given more than once, it will match against all the", From e7e52d1808a9e13b419ba9eee6cfde451ec6be6d Mon Sep 17 00:00:00 2001 From: Dana Scheider Date: Thu, 13 Aug 2015 14:19:58 -0700 Subject: [PATCH 10/11] Add fail_fast to options hash with :fail_fast? method --- lib/cucumber/configuration.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/cucumber/configuration.rb b/lib/cucumber/configuration.rb index 89b64f7302..5329413fa6 100644 --- a/lib/cucumber/configuration.rb +++ b/lib/cucumber/configuration.rb @@ -41,6 +41,10 @@ def dry_run? @options[:dry_run] end + def fail_fast? + @options[:fail_fast] + end + def guess? @options[:guess] end @@ -182,6 +186,7 @@ def default_options :strict => false, :require => [], :dry_run => false, + :fail_fast => false, :formats => [], :excludes => [], :tag_expressions => [], From ef93747623128b356c3afb5c6201659170cd1313 Mon Sep 17 00:00:00 2001 From: Dana Scheider Date: Sat, 15 Aug 2015 13:21:34 -0700 Subject: [PATCH 11/11] Add @spawn tag to fail-fast feature --- features/docs/cli/fail_fast.feature | 1 + 1 file changed, 1 insertion(+) diff --git a/features/docs/cli/fail_fast.feature b/features/docs/cli/fail_fast.feature index d16512e2ee..4c6d3719f3 100644 --- a/features/docs/cli/fail_fast.feature +++ b/features/docs/cli/fail_fast.feature @@ -1,3 +1,4 @@ +@spawn Feature: Fail fast The --fail-fast flag causes Cucumber to exit immediately after the first