cucumber 3.1.2 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +173 -14
- data/CONTRIBUTING.md +2 -18
- data/README.md +4 -5
- data/bin/cucumber +1 -1
- data/lib/autotest/cucumber_mixin.rb +34 -39
- data/lib/cucumber.rb +1 -1
- data/lib/cucumber/cli/configuration.rb +5 -5
- data/lib/cucumber/cli/main.rb +12 -12
- data/lib/cucumber/cli/options.rb +69 -74
- data/lib/cucumber/cli/profile_loader.rb +49 -26
- data/lib/cucumber/configuration.rb +31 -23
- data/lib/cucumber/constantize.rb +2 -5
- data/lib/cucumber/deprecate.rb +31 -7
- data/lib/cucumber/errors.rb +5 -7
- data/lib/cucumber/events.rb +13 -6
- data/lib/cucumber/events/envelope.rb +9 -0
- data/lib/cucumber/events/gherkin_source_parsed.rb +11 -0
- data/lib/cucumber/events/hook_test_step_created.rb +13 -0
- data/lib/cucumber/events/step_activated.rb +2 -1
- data/lib/cucumber/events/test_case_created.rb +13 -0
- data/lib/cucumber/events/test_case_ready.rb +12 -0
- data/lib/cucumber/events/test_step_created.rb +13 -0
- data/lib/cucumber/events/undefined_parameter_type.rb +10 -0
- data/lib/cucumber/file_specs.rb +6 -6
- data/lib/cucumber/filters.rb +1 -0
- data/lib/cucumber/filters/activate_steps.rb +5 -3
- data/lib/cucumber/filters/broadcast_test_case_ready_event.rb +12 -0
- data/lib/cucumber/filters/prepare_world.rb +5 -9
- data/lib/cucumber/filters/quit.rb +1 -3
- data/lib/cucumber/filters/tag_limits/verifier.rb +2 -4
- data/lib/cucumber/formatter/ansicolor.rb +40 -45
- data/lib/cucumber/formatter/ast_lookup.rb +165 -0
- data/lib/cucumber/formatter/backtrace_filter.rb +9 -8
- data/lib/cucumber/formatter/console.rb +58 -66
- data/lib/cucumber/formatter/console_counts.rb +4 -9
- data/lib/cucumber/formatter/console_issues.rb +6 -3
- data/lib/cucumber/formatter/duration.rb +1 -1
- data/lib/cucumber/formatter/duration_extractor.rb +3 -1
- data/lib/cucumber/formatter/errors.rb +6 -0
- data/lib/cucumber/formatter/fanout.rb +2 -0
- data/lib/cucumber/formatter/html.rb +11 -598
- data/lib/cucumber/formatter/http_io.rb +146 -0
- data/lib/cucumber/formatter/ignore_missing_messages.rb +1 -1
- data/lib/cucumber/formatter/interceptor.rb +8 -28
- data/lib/cucumber/formatter/io.rb +17 -11
- data/lib/cucumber/formatter/json.rb +101 -109
- data/lib/cucumber/formatter/junit.rb +56 -56
- data/lib/cucumber/formatter/message.rb +22 -0
- data/lib/cucumber/formatter/message_builder.rb +255 -0
- data/lib/cucumber/formatter/pretty.rb +359 -153
- data/lib/cucumber/formatter/progress.rb +30 -32
- data/lib/cucumber/formatter/query/hook_by_test_step.rb +31 -0
- data/lib/cucumber/formatter/query/pickle_by_test.rb +26 -0
- data/lib/cucumber/formatter/query/pickle_step_by_test_step.rb +26 -0
- data/lib/cucumber/formatter/query/step_definitions_by_test_step.rb +40 -0
- data/lib/cucumber/formatter/query/test_case_started_by_test_case.rb +40 -0
- data/lib/cucumber/formatter/rerun.rb +22 -4
- data/lib/cucumber/formatter/stepdefs.rb +1 -2
- data/lib/cucumber/formatter/steps.rb +2 -3
- data/lib/cucumber/formatter/summary.rb +16 -8
- data/lib/cucumber/formatter/unicode.rb +15 -17
- data/lib/cucumber/formatter/usage.rb +11 -10
- data/lib/cucumber/gherkin/data_table_parser.rb +17 -6
- data/lib/cucumber/gherkin/formatter/ansi_escapes.rb +13 -17
- data/lib/cucumber/gherkin/formatter/escaping.rb +2 -2
- data/lib/cucumber/gherkin/steps_parser.rb +17 -8
- data/lib/cucumber/glue/dsl.rb +1 -1
- data/lib/cucumber/glue/hook.rb +34 -11
- data/lib/cucumber/glue/invoke_in_world.rb +13 -18
- data/lib/cucumber/glue/proto_world.rb +42 -33
- data/lib/cucumber/glue/registry_and_more.rb +42 -12
- data/lib/cucumber/glue/snippet.rb +23 -22
- data/lib/cucumber/glue/step_definition.rb +42 -19
- data/lib/cucumber/glue/world_factory.rb +1 -1
- data/lib/cucumber/hooks.rb +11 -11
- data/lib/cucumber/multiline_argument.rb +4 -6
- data/lib/cucumber/multiline_argument/data_table.rb +97 -64
- data/lib/cucumber/multiline_argument/data_table/diff_matrices.rb +1 -1
- data/lib/cucumber/multiline_argument/doc_string.rb +1 -1
- data/lib/cucumber/platform.rb +3 -3
- data/lib/cucumber/rake/task.rb +16 -16
- data/lib/cucumber/rspec/disable_option_parser.rb +9 -8
- data/lib/cucumber/running_test_case.rb +2 -53
- data/lib/cucumber/runtime.rb +54 -58
- data/lib/cucumber/runtime/after_hooks.rb +8 -4
- data/lib/cucumber/runtime/before_hooks.rb +8 -4
- data/lib/cucumber/runtime/for_programming_languages.rb +4 -2
- data/lib/cucumber/runtime/step_hooks.rb +3 -2
- data/lib/cucumber/runtime/support_code.rb +13 -15
- data/lib/cucumber/runtime/user_interface.rb +6 -16
- data/lib/cucumber/step_definition_light.rb +4 -3
- data/lib/cucumber/step_definitions.rb +2 -2
- data/lib/cucumber/step_match.rb +12 -11
- data/lib/cucumber/step_match_search.rb +2 -1
- data/lib/cucumber/term/ansicolor.rb +9 -9
- data/lib/cucumber/version +1 -1
- metadata +224 -82
- data/lib/cucumber/events/gherkin_source_parsed.rb~ +0 -14
- data/lib/cucumber/formatter/ast_lookup.rb~ +0 -9
- data/lib/cucumber/formatter/cucumber.css +0 -286
- data/lib/cucumber/formatter/cucumber.sass +0 -247
- data/lib/cucumber/formatter/hook_query_visitor.rb +0 -42
- data/lib/cucumber/formatter/html_builder.rb +0 -121
- data/lib/cucumber/formatter/inline-js.js +0 -30
- data/lib/cucumber/formatter/jquery-min.js +0 -154
- data/lib/cucumber/formatter/json_pretty.rb +0 -11
- data/lib/cucumber/formatter/legacy_api/adapter.rb +0 -1028
- data/lib/cucumber/formatter/legacy_api/ast.rb +0 -394
- data/lib/cucumber/formatter/legacy_api/results.rb +0 -50
- data/lib/cucumber/formatter/legacy_api/runtime_facade.rb +0 -32
- data/lib/cucumber/step_argument.rb +0 -25
@@ -135,7 +135,7 @@ module Cucumber
|
|
135
135
|
def raise_error
|
136
136
|
table = DataTable.from([[]])
|
137
137
|
table.instance_variable_set :@cell_matrix, cell_matrix
|
138
|
-
raise Different
|
138
|
+
raise Different, table if should_raise?
|
139
139
|
end
|
140
140
|
|
141
141
|
def should_raise?
|
data/lib/cucumber/platform.rb
CHANGED
@@ -7,7 +7,7 @@ require 'cucumber/core/platform'
|
|
7
7
|
|
8
8
|
module Cucumber
|
9
9
|
unless defined?(Cucumber::VERSION)
|
10
|
-
VERSION = File.read(File.expand_path('
|
10
|
+
VERSION = File.read(File.expand_path('version', __dir__)).strip
|
11
11
|
BINARY = File.expand_path(File.dirname(__FILE__) + '/../../bin/cucumber')
|
12
12
|
LIBDIR = File.expand_path(File.dirname(__FILE__) + '/../../lib')
|
13
13
|
RAILS = defined?(Rails)
|
@@ -18,8 +18,8 @@ module Cucumber
|
|
18
18
|
attr_accessor :use_full_backtrace
|
19
19
|
|
20
20
|
# @private
|
21
|
-
def file_mode(
|
22
|
-
"#{
|
21
|
+
def file_mode(mode, encoding = 'UTF-8')
|
22
|
+
"#{mode}:#{encoding}"
|
23
23
|
end
|
24
24
|
end
|
25
25
|
self.use_full_backtrace = false
|
data/lib/cucumber/rake/task.rb
CHANGED
@@ -38,8 +38,8 @@ module Cucumber
|
|
38
38
|
attr_reader :args
|
39
39
|
|
40
40
|
def initialize(libs, cucumber_opts, feature_files)
|
41
|
-
raise 'libs must be an Array when running in-process' unless Array
|
42
|
-
libs.
|
41
|
+
raise 'libs must be an Array when running in-process' unless Array == libs.class
|
42
|
+
libs.reverse_each { |lib| $LOAD_PATH.unshift(lib) }
|
43
43
|
@args = (
|
44
44
|
cucumber_opts +
|
45
45
|
feature_files
|
@@ -65,11 +65,11 @@ module Cucumber
|
|
65
65
|
end
|
66
66
|
|
67
67
|
def load_path
|
68
|
-
[format('"
|
68
|
+
[format('"%<path>s"', path: @libs.join(File::PATH_SEPARATOR))]
|
69
69
|
end
|
70
70
|
|
71
71
|
def quoted_binary(cucumber_bin)
|
72
|
-
[format('"
|
72
|
+
[format('"%<path>s"', path: cucumber_bin)]
|
73
73
|
end
|
74
74
|
|
75
75
|
def use_bundler
|
@@ -98,9 +98,7 @@ module Cucumber
|
|
98
98
|
|
99
99
|
def run
|
100
100
|
sh cmd.join(' ') do |ok, res|
|
101
|
-
|
102
|
-
exit res.exitstatus
|
103
|
-
end
|
101
|
+
exit res.exitstatus unless ok
|
104
102
|
end
|
105
103
|
end
|
106
104
|
end
|
@@ -113,9 +111,9 @@ module Cucumber
|
|
113
111
|
|
114
112
|
# Extra options to pass to the cucumber binary. Can be overridden by the CUCUMBER_OPTS environment variable.
|
115
113
|
# It's recommended to pass an Array, but if it's a String it will be #split by ' '.
|
116
|
-
|
114
|
+
attr_reader :cucumber_opts
|
117
115
|
def cucumber_opts=(opts) #:nodoc:
|
118
|
-
@cucumber_opts = String
|
116
|
+
@cucumber_opts = String == opts.class ? opts.split(' ') : opts
|
119
117
|
end
|
120
118
|
|
121
119
|
# Whether or not to fork a new ruby interpreter. Defaults to true. You may gain
|
@@ -134,12 +132,16 @@ module Cucumber
|
|
134
132
|
# Note that this attribute has no effect if you don't run in forked mode.
|
135
133
|
attr_accessor :bundler
|
136
134
|
|
135
|
+
# Name of the running task
|
136
|
+
attr_reader :task_name
|
137
|
+
|
137
138
|
# Define Cucumber Rake task
|
138
139
|
def initialize(task_name = 'cucumber', desc = 'Run Cucumber features')
|
139
|
-
@task_name
|
140
|
+
@task_name = task_name
|
141
|
+
@desc = desc
|
140
142
|
@fork = true
|
141
143
|
@libs = ['lib']
|
142
|
-
@rcov_opts = %w
|
144
|
+
@rcov_opts = %w[--rails --exclude osx\/objc,gems\/]
|
143
145
|
yield self if block_given?
|
144
146
|
@binary = binary.nil? ? Cucumber::BINARY : File.expand_path(binary)
|
145
147
|
define_task
|
@@ -154,18 +156,16 @@ module Cucumber
|
|
154
156
|
|
155
157
|
def runner(_task_args = nil) #:nodoc:
|
156
158
|
cucumber_opts = [(ENV['CUCUMBER_OPTS'] ? ENV['CUCUMBER_OPTS'].split(/\s+/) : nil) || cucumber_opts_with_profile]
|
157
|
-
if
|
158
|
-
return ForkedCucumberRunner.new(libs, binary, cucumber_opts, bundler, feature_files)
|
159
|
-
end
|
159
|
+
return ForkedCucumberRunner.new(libs, binary, cucumber_opts, bundler, feature_files) if fork
|
160
160
|
InProcessCucumberRunner.new(libs, cucumber_opts, feature_files)
|
161
161
|
end
|
162
162
|
|
163
163
|
def cucumber_opts_with_profile #:nodoc:
|
164
|
-
Array(cucumber_opts).concat
|
164
|
+
Array(cucumber_opts).concat(Array(@profile).flat_map { |p| ['--profile', p] })
|
165
165
|
end
|
166
166
|
|
167
167
|
def feature_files #:nodoc:
|
168
|
-
make_command_line_safe(FileList[
|
168
|
+
make_command_line_safe(FileList[ENV['FEATURE'] || []])
|
169
169
|
end
|
170
170
|
|
171
171
|
def make_command_line_safe(list)
|
@@ -9,16 +9,17 @@ module Spec #:nodoc:
|
|
9
9
|
# will fail when running cucumber)
|
10
10
|
class OptionParser < ::OptionParser #:nodoc:
|
11
11
|
NEUTERED_RSPEC = Object.new
|
12
|
-
def NEUTERED_RSPEC.method_missing(
|
12
|
+
def NEUTERED_RSPEC.method_missing(_method, *_args) # rubocop:disable Style/MissingRespondToMissing
|
13
|
+
self || super
|
14
|
+
end
|
13
15
|
|
14
|
-
def self.method_added(
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
end
|
20
|
-
@__neutering_rspec = false
|
16
|
+
def self.method_added(method)
|
17
|
+
return if @__neutering_rspec
|
18
|
+
@__neutering_rspec = true
|
19
|
+
define_method(method) do |*_a|
|
20
|
+
NEUTERED_RSPEC
|
21
21
|
end
|
22
|
+
@__neutering_rspec = false
|
22
23
|
end
|
23
24
|
end
|
24
25
|
end
|
@@ -15,45 +15,12 @@ module Cucumber
|
|
15
15
|
# the passed / failed / undefined / skipped status of
|
16
16
|
# the test case.
|
17
17
|
#
|
18
|
-
# The test case might come from a regular Scenario or
|
19
|
-
# a Scenario outline. You can call the `#outline?`
|
20
|
-
# predicate to find out. If it's from an outline,
|
21
|
-
# you get a couple of extra methods.
|
22
18
|
module RunningTestCase
|
23
19
|
def self.new(test_case)
|
24
|
-
|
20
|
+
TestCase.new(test_case)
|
25
21
|
end
|
26
22
|
|
27
|
-
class
|
28
|
-
def initialize(test_case)
|
29
|
-
@test_case = test_case
|
30
|
-
test_case.describe_source_to(self)
|
31
|
-
end
|
32
|
-
|
33
|
-
def feature(feature)
|
34
|
-
end
|
35
|
-
|
36
|
-
def scenario(_scenario)
|
37
|
-
@factory = Scenario
|
38
|
-
end
|
39
|
-
|
40
|
-
def scenario_outline(_scenario)
|
41
|
-
@factory = ScenarioOutlineExample
|
42
|
-
end
|
43
|
-
|
44
|
-
def examples_table(examples_table)
|
45
|
-
end
|
46
|
-
|
47
|
-
def examples_table_row(row)
|
48
|
-
end
|
49
|
-
|
50
|
-
def running_test_case
|
51
|
-
@factory.new(@test_case)
|
52
|
-
end
|
53
|
-
end
|
54
|
-
private_constant :Builder
|
55
|
-
|
56
|
-
class Scenario < SimpleDelegator
|
23
|
+
class TestCase < SimpleDelegator
|
57
24
|
def initialize(test_case, result = Core::Test::Result::Unknown.new)
|
58
25
|
@test_case = test_case
|
59
26
|
@result = result
|
@@ -85,27 +52,9 @@ module Cucumber
|
|
85
52
|
tags.map &:name
|
86
53
|
end
|
87
54
|
|
88
|
-
def outline?
|
89
|
-
false
|
90
|
-
end
|
91
|
-
|
92
55
|
def with_result(result)
|
93
56
|
self.class.new(@test_case, result)
|
94
57
|
end
|
95
58
|
end
|
96
|
-
|
97
|
-
class ScenarioOutlineExample < Scenario
|
98
|
-
def outline?
|
99
|
-
true
|
100
|
-
end
|
101
|
-
|
102
|
-
def scenario_outline
|
103
|
-
self
|
104
|
-
end
|
105
|
-
|
106
|
-
def cell_values
|
107
|
-
source.last.values
|
108
|
-
end
|
109
|
-
end
|
110
59
|
end
|
111
60
|
end
|
data/lib/cucumber/runtime.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
1
|
# frozen_string_literal: true
|
3
2
|
|
4
3
|
require 'fileutils'
|
5
|
-
require 'multi_json'
|
6
4
|
require 'cucumber/configuration'
|
7
5
|
require 'cucumber/load_path'
|
8
6
|
require 'cucumber/formatter/duration'
|
@@ -11,6 +9,8 @@ require 'cucumber/filters'
|
|
11
9
|
require 'cucumber/formatter/fanout'
|
12
10
|
require 'cucumber/gherkin/i18n'
|
13
11
|
require 'cucumber/step_match_search'
|
12
|
+
require 'cucumber/messages'
|
13
|
+
require 'sys/uname'
|
14
14
|
|
15
15
|
module Cucumber
|
16
16
|
module FixRuby21Bug9285
|
@@ -19,8 +19,8 @@ module Cucumber
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
class FileException <
|
23
|
-
|
22
|
+
class FileException < RuntimeError
|
23
|
+
attr_reader :path
|
24
24
|
|
25
25
|
def initialize(original_exception, path)
|
26
26
|
super(original_exception)
|
@@ -31,7 +31,7 @@ module Cucumber
|
|
31
31
|
class FileNotFoundException < FileException
|
32
32
|
end
|
33
33
|
|
34
|
-
class FeatureFolderNotFoundException <
|
34
|
+
class FeatureFolderNotFoundException < RuntimeError
|
35
35
|
def initialize(path)
|
36
36
|
@path = path
|
37
37
|
end
|
@@ -54,7 +54,6 @@ module Cucumber
|
|
54
54
|
def initialize(configuration = Configuration.default)
|
55
55
|
@configuration = Configuration.new(configuration)
|
56
56
|
@support_code = SupportCode.new(self, @configuration)
|
57
|
-
@results = Formatter::LegacyApi::Results.new
|
58
57
|
end
|
59
58
|
|
60
59
|
# Allows you to take an existing runtime and change its configuration
|
@@ -65,6 +64,10 @@ module Cucumber
|
|
65
64
|
|
66
65
|
require 'cucumber/wire/plugin'
|
67
66
|
def run!
|
67
|
+
@configuration.notify :envelope, Cucumber::Messages::Envelope.new(
|
68
|
+
meta: make_meta
|
69
|
+
)
|
70
|
+
|
68
71
|
load_step_definitions
|
69
72
|
install_wire_plugin
|
70
73
|
fire_after_configuration_hook
|
@@ -72,7 +75,7 @@ module Cucumber
|
|
72
75
|
self.visitor = report
|
73
76
|
|
74
77
|
receiver = Test::Runner.new(@configuration.event_bus)
|
75
|
-
compile features, receiver, filters
|
78
|
+
compile features, receiver, filters, @configuration.event_bus
|
76
79
|
@configuration.notify :test_run_finished
|
77
80
|
end
|
78
81
|
|
@@ -84,14 +87,6 @@ module Cucumber
|
|
84
87
|
@configuration.dry_run?
|
85
88
|
end
|
86
89
|
|
87
|
-
def scenarios(status = nil)
|
88
|
-
@results.scenarios(status)
|
89
|
-
end
|
90
|
-
|
91
|
-
def steps(status = nil)
|
92
|
-
@results.steps(status)
|
93
|
-
end
|
94
|
-
|
95
90
|
def unmatched_step_definitions
|
96
91
|
@support_code.unmatched_step_definitions
|
97
92
|
end
|
@@ -107,13 +102,33 @@ module Cucumber
|
|
107
102
|
# Returns Ast::DocString for +string_without_triple_quotes+.
|
108
103
|
#
|
109
104
|
def doc_string(string_without_triple_quotes, content_type = '', _line_offset = 0)
|
110
|
-
|
111
|
-
|
105
|
+
Core::Test::DocString.new(string_without_triple_quotes, content_type)
|
106
|
+
end
|
107
|
+
|
108
|
+
def make_meta
|
109
|
+
Cucumber::Messages::Meta.new(
|
110
|
+
protocol_version: Cucumber::Messages::VERSION,
|
111
|
+
implementation: Cucumber::Messages::Meta::Product.new(
|
112
|
+
name: 'cucumber-ruby',
|
113
|
+
version: Cucumber::VERSION
|
114
|
+
),
|
115
|
+
runtime: Cucumber::Messages::Meta::Product.new(
|
116
|
+
name: RUBY_ENGINE,
|
117
|
+
version: RUBY_VERSION
|
118
|
+
),
|
119
|
+
os: Cucumber::Messages::Meta::Product.new(
|
120
|
+
name: RbConfig::CONFIG['target_os'],
|
121
|
+
version: Sys::Uname.uname.version
|
122
|
+
),
|
123
|
+
cpu: Cucumber::Messages::Meta::Product.new(
|
124
|
+
name: RbConfig::CONFIG['target_cpu']
|
125
|
+
)
|
126
|
+
)
|
112
127
|
end
|
113
128
|
|
114
129
|
private
|
115
130
|
|
116
|
-
def fire_after_configuration_hook #:nodoc
|
131
|
+
def fire_after_configuration_hook #:nodoc:
|
117
132
|
@support_code.fire_hook(:after_configuration, @configuration)
|
118
133
|
end
|
119
134
|
|
@@ -143,14 +158,12 @@ module Cucumber
|
|
143
158
|
end
|
144
159
|
|
145
160
|
def initialize(path)
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
raise FeatureFolderNotFoundException.new(path)
|
153
|
-
end
|
161
|
+
@file = File.new(path)
|
162
|
+
set_encoding
|
163
|
+
rescue Errno::EACCES => e
|
164
|
+
raise FileNotFoundException.new(e, File.expand_path(path))
|
165
|
+
rescue Errno::ENOENT
|
166
|
+
raise FeatureFolderNotFoundException, path
|
154
167
|
end
|
155
168
|
|
156
169
|
def read
|
@@ -162,7 +175,7 @@ module Cucumber
|
|
162
175
|
def set_encoding
|
163
176
|
@file.each do |line|
|
164
177
|
if ENCODING_PATTERN =~ line
|
165
|
-
@file.set_encoding
|
178
|
+
@file.set_encoding Regexp.last_match(1)
|
166
179
|
break
|
167
180
|
end
|
168
181
|
break unless COMMENT_OR_EMPTY_LINE_PATTERN =~ line
|
@@ -171,9 +184,6 @@ module Cucumber
|
|
171
184
|
end
|
172
185
|
end
|
173
186
|
|
174
|
-
require 'cucumber/formatter/legacy_api/adapter'
|
175
|
-
require 'cucumber/formatter/legacy_api/runtime_facade'
|
176
|
-
require 'cucumber/formatter/legacy_api/results'
|
177
187
|
require 'cucumber/formatter/ignore_missing_messages'
|
178
188
|
require 'cucumber/formatter/fail_fast'
|
179
189
|
require 'cucumber/core/report/summary'
|
@@ -194,39 +204,26 @@ module Cucumber
|
|
194
204
|
|
195
205
|
def formatters
|
196
206
|
@formatters ||=
|
197
|
-
@configuration.formatter_factories do |factory, formatter_options, path_or_io
|
198
|
-
create_formatter(factory, formatter_options, path_or_io
|
207
|
+
@configuration.formatter_factories do |factory, formatter_options, path_or_io|
|
208
|
+
create_formatter(factory, formatter_options, path_or_io)
|
199
209
|
end
|
200
210
|
end
|
201
211
|
|
202
|
-
def create_formatter(factory, formatter_options, path_or_io
|
203
|
-
if
|
204
|
-
if
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
return factory.new(@configuration.with_options(out_stream: path_or_io))
|
211
|
-
end
|
212
|
+
def create_formatter(factory, formatter_options, path_or_io)
|
213
|
+
if accept_options?(factory)
|
214
|
+
return factory.new(@configuration, formatter_options) if path_or_io.nil?
|
215
|
+
factory.new(@configuration.with_options(out_stream: path_or_io),
|
216
|
+
formatter_options)
|
217
|
+
else
|
218
|
+
return factory.new(@configuration) if path_or_io.nil?
|
219
|
+
factory.new(@configuration.with_options(out_stream: path_or_io))
|
212
220
|
end
|
213
|
-
results = Formatter::LegacyApi::Results.new
|
214
|
-
runtime_facade = Formatter::LegacyApi::RuntimeFacade.new(results, @support_code, @configuration)
|
215
|
-
formatter = factory.new(runtime_facade, path_or_io, cli_options)
|
216
|
-
Formatter::LegacyApi::Adapter.new(
|
217
|
-
Formatter::IgnoreMissingMessages.new(formatter),
|
218
|
-
results, @configuration
|
219
|
-
)
|
220
221
|
end
|
221
222
|
|
222
223
|
def accept_options?(factory)
|
223
224
|
factory.instance_method(:initialize).arity > 1
|
224
225
|
end
|
225
226
|
|
226
|
-
def legacy_formatter?(factory)
|
227
|
-
factory.instance_method(:initialize).arity > 2
|
228
|
-
end
|
229
|
-
|
230
227
|
def failure?
|
231
228
|
if @configuration.wip?
|
232
229
|
summary_report.test_cases.total_passed > 0
|
@@ -237,7 +234,7 @@ module Cucumber
|
|
237
234
|
public :failure?
|
238
235
|
|
239
236
|
require 'cucumber/core/test/filters'
|
240
|
-
def filters
|
237
|
+
def filters # rubocop:disable Metrics/AbcSize
|
241
238
|
tag_expressions = @configuration.tag_expressions
|
242
239
|
name_regexps = @configuration.name_regexps
|
243
240
|
tag_limits = @configuration.tag_limits
|
@@ -250,14 +247,13 @@ module Cucumber
|
|
250
247
|
# TODO: can we just use Glue::RegistryAndMore's step definitions directly?
|
251
248
|
step_match_search = StepMatchSearch.new(@support_code.registry.method(:step_matches), @configuration)
|
252
249
|
filters << Filters::ActivateSteps.new(step_match_search, @configuration)
|
253
|
-
@configuration.filters.each
|
254
|
-
filters << filter
|
255
|
-
end
|
250
|
+
@configuration.filters.each { |filter| filters << filter }
|
256
251
|
unless configuration.dry_run?
|
257
252
|
filters << Filters::ApplyAfterStepHooks.new(@support_code)
|
258
253
|
filters << Filters::ApplyBeforeHooks.new(@support_code)
|
259
254
|
filters << Filters::ApplyAfterHooks.new(@support_code)
|
260
255
|
filters << Filters::ApplyAroundHooks.new(@support_code)
|
256
|
+
filters << Filters::BroadcastTestCaseReadyEvent.new(@configuration)
|
261
257
|
filters << Filters::BroadcastTestRunStartedEvent.new(@configuration)
|
262
258
|
filters << Filters::Quit.new
|
263
259
|
filters << Filters::Retry.new(@configuration)
|
@@ -273,7 +269,7 @@ module Cucumber
|
|
273
269
|
end
|
274
270
|
|
275
271
|
def install_wire_plugin
|
276
|
-
Cucumber::Wire::Plugin.new(@configuration).install if @configuration.all_files_to_load.any? { |f| f =~
|
272
|
+
Cucumber::Wire::Plugin.new(@configuration, @support_code.registry).install if @configuration.all_files_to_load.any? { |f| f =~ /\.wire$/ }
|
277
273
|
end
|
278
274
|
|
279
275
|
def log
|