cucumber 7.1.0 → 9.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +17 -27
- data/VERSION +1 -0
- data/lib/cucumber/cli/configuration.rb +4 -1
- data/lib/cucumber/cli/main.rb +5 -4
- data/lib/cucumber/cli/options.rb +73 -67
- data/lib/cucumber/cli/profile_loader.rb +6 -10
- data/lib/cucumber/cli/rerun_file.rb +1 -1
- data/lib/cucumber/configuration.rb +12 -6
- data/lib/cucumber/constantize.rb +1 -1
- data/lib/cucumber/deprecate.rb +6 -46
- data/lib/cucumber/errors.rb +3 -2
- data/lib/cucumber/events/envelope.rb +2 -0
- data/lib/cucumber/events/gherkin_source_parsed.rb +2 -0
- data/lib/cucumber/events/gherkin_source_read.rb +2 -0
- data/lib/cucumber/events/hook_test_step_created.rb +1 -2
- data/lib/cucumber/events/step_activated.rb +0 -6
- data/lib/cucumber/events/step_definition_registered.rb +0 -5
- data/lib/cucumber/events/test_case_created.rb +1 -2
- data/lib/cucumber/events/test_case_finished.rb +2 -0
- data/lib/cucumber/events/test_case_started.rb +2 -0
- data/lib/cucumber/events/test_run_finished.rb +2 -1
- data/lib/cucumber/events/test_step_created.rb +1 -2
- data/lib/cucumber/events/test_step_finished.rb +2 -0
- data/lib/cucumber/events/test_step_started.rb +2 -0
- data/lib/cucumber/events/undefined_parameter_type.rb +3 -2
- data/lib/cucumber/events.rb +1 -1
- data/lib/cucumber/file_specs.rb +2 -1
- data/lib/cucumber/filters/activate_steps.rb +1 -0
- data/lib/cucumber/filters/retry.rb +20 -1
- data/lib/cucumber/filters/tag_limits/verifier.rb +1 -3
- data/lib/cucumber/filters/tag_limits.rb +1 -3
- data/lib/cucumber/formatter/ansicolor.rb +70 -78
- data/lib/cucumber/formatter/ast_lookup.rb +16 -8
- data/lib/cucumber/formatter/backtrace_filter.rb +2 -1
- data/lib/cucumber/formatter/console.rb +26 -16
- data/lib/cucumber/formatter/console_counts.rb +3 -1
- data/lib/cucumber/formatter/console_issues.rb +10 -3
- data/lib/cucumber/formatter/curl_option_parser.rb +49 -0
- data/lib/cucumber/formatter/duration_extractor.rb +1 -0
- data/lib/cucumber/formatter/errors.rb +3 -0
- data/lib/cucumber/formatter/fail_fast.rb +1 -1
- data/lib/cucumber/formatter/fanout.rb +1 -1
- data/lib/cucumber/formatter/html.rb +2 -0
- data/lib/cucumber/formatter/http_io.rb +10 -137
- data/lib/cucumber/formatter/ignore_missing_messages.rb +1 -1
- data/lib/cucumber/formatter/io.rb +5 -3
- data/lib/cucumber/formatter/io_http_buffer.rb +88 -0
- data/lib/cucumber/formatter/json.rb +10 -12
- data/lib/cucumber/formatter/junit.rb +10 -7
- data/lib/cucumber/formatter/message_builder.rb +24 -8
- data/lib/cucumber/formatter/pretty.rb +24 -10
- data/lib/cucumber/formatter/progress.rb +1 -0
- data/lib/cucumber/formatter/publish_banner_printer.rb +0 -2
- data/lib/cucumber/formatter/query/hook_by_test_step.rb +3 -0
- data/lib/cucumber/formatter/query/pickle_by_test.rb +2 -0
- data/lib/cucumber/formatter/query/pickle_step_by_test_step.rb +2 -0
- data/lib/cucumber/formatter/query/step_definitions_by_test_step.rb +2 -0
- data/lib/cucumber/formatter/query/test_case_started_by_test_case.rb +4 -0
- data/lib/cucumber/formatter/rerun.rb +5 -3
- data/lib/cucumber/formatter/summary.rb +1 -0
- data/lib/cucumber/formatter/unicode.rb +7 -7
- data/lib/cucumber/formatter/url_reporter.rb +3 -1
- data/lib/cucumber/formatter/usage.rb +3 -3
- data/lib/cucumber/gherkin/data_table_parser.rb +1 -0
- data/lib/cucumber/gherkin/formatter/ansi_escapes.rb +25 -27
- data/lib/cucumber/glue/dsl.rb +20 -25
- data/lib/cucumber/glue/hook.rb +6 -3
- data/lib/cucumber/glue/invoke_in_world.rb +5 -5
- data/lib/cucumber/glue/proto_world.rb +30 -34
- data/lib/cucumber/glue/registry_and_more.rb +15 -25
- data/lib/cucumber/glue/snippet.rb +4 -2
- data/lib/cucumber/glue/step_definition.rb +6 -3
- data/lib/cucumber/glue/world_factory.rb +2 -0
- data/lib/cucumber/hooks.rb +1 -0
- data/lib/cucumber/multiline_argument/data_table/diff_matrices.rb +4 -1
- data/lib/cucumber/multiline_argument/data_table.rb +68 -80
- data/lib/cucumber/platform.rb +11 -16
- data/lib/cucumber/rake/task.rb +22 -15
- data/lib/cucumber/rspec/disable_option_parser.rb +6 -3
- data/lib/cucumber/running_test_case.rb +2 -1
- data/lib/cucumber/runtime/for_programming_languages.rb +1 -2
- data/lib/cucumber/runtime/meta_message_builder.rb +108 -0
- data/lib/cucumber/runtime/support_code.rb +3 -0
- data/lib/cucumber/runtime/user_interface.rb +7 -6
- data/lib/cucumber/runtime.rb +22 -38
- data/lib/cucumber/step_match.rb +6 -4
- data/lib/cucumber/step_match_search.rb +3 -2
- data/lib/cucumber/term/ansicolor.rb +74 -50
- data/lib/cucumber/term/banner.rb +3 -0
- data/lib/cucumber.rb +2 -1
- data/lib/simplecov_setup.rb +1 -1
- metadata +95 -244
- data/CHANGELOG.md +0 -3131
- data/CONTRIBUTING.md +0 -250
- data/lib/autotest/cucumber.rb +0 -8
- data/lib/autotest/cucumber_mixin.rb +0 -130
- data/lib/autotest/cucumber_rails.rb +0 -8
- data/lib/autotest/cucumber_rails_rspec.rb +0 -8
- data/lib/autotest/cucumber_rails_rspec2.rb +0 -8
- data/lib/autotest/cucumber_rspec.rb +0 -8
- data/lib/autotest/cucumber_rspec2.rb +0 -8
- data/lib/autotest/discover.rb +0 -13
- data/lib/cucumber/version +0 -1
data/lib/cucumber/deprecate.rb
CHANGED
@@ -4,51 +4,11 @@ require 'cucumber/platform'
|
|
4
4
|
require 'cucumber/gherkin/formatter/ansi_escapes'
|
5
5
|
|
6
6
|
module Cucumber
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
end
|
14
|
-
|
15
|
-
def failure_message(message)
|
16
|
-
failed + message + reset
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
class CliOption
|
21
|
-
def self.deprecate(stream, option, message, remove_after_version)
|
22
|
-
return if stream.nil?
|
23
|
-
stream.puts(
|
24
|
-
AnsiString.failure_message(
|
25
|
-
"\nWARNING: #{option} is deprecated" \
|
26
|
-
" and will be removed after version #{remove_after_version}.\n#{message}.\n"
|
27
|
-
)
|
28
|
-
)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
module ForUsers
|
33
|
-
def self.call(message, method, remove_after_version)
|
34
|
-
STDERR.puts AnsiString.failure_message(
|
35
|
-
"\nWARNING: ##{method} is deprecated" \
|
36
|
-
" and will be removed after version #{remove_after_version}. #{message}.\n" \
|
37
|
-
"(Called from #{caller(3..3).first})"
|
38
|
-
)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
module ForDevelopers
|
43
|
-
def self.call(_message, _method, remove_after_version)
|
44
|
-
raise "This method is due for removal after version #{remove_after_version}" if Cucumber::VERSION >= remove_after_version
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
STRATEGY = $PROGRAM_NAME =~ /rspec$/ ? ForDevelopers : ForUsers
|
49
|
-
end
|
50
|
-
|
51
|
-
def self.deprecate(*args)
|
52
|
-
Deprecate::STRATEGY.call(*args)
|
7
|
+
def self.deprecate(message, method, remove_after_version)
|
8
|
+
$stderr.puts(
|
9
|
+
"\nWARNING: ##{method} is deprecated" \
|
10
|
+
" and will be removed after version #{remove_after_version}. #{message}.\n" \
|
11
|
+
"(Called from #{caller(3..3).first})"
|
12
|
+
)
|
53
13
|
end
|
54
14
|
end
|
data/lib/cucumber/errors.rb
CHANGED
@@ -9,7 +9,7 @@ module Cucumber
|
|
9
9
|
return result.with_message(with_prefix(result.message)) if result.is_a?(self)
|
10
10
|
|
11
11
|
begin
|
12
|
-
raise
|
12
|
+
raise self, with_prefix(step_name)
|
13
13
|
rescue StandardError => e
|
14
14
|
e
|
15
15
|
end
|
@@ -35,7 +35,8 @@ module Cucumber
|
|
35
35
|
# Raised when a step matches 2 or more StepDefinitions
|
36
36
|
class Ambiguous < StandardError
|
37
37
|
def initialize(step_name, step_definitions, used_guess)
|
38
|
-
|
38
|
+
# TODO: [LH] - Just use a heredoc here to fix this up
|
39
|
+
message = String.new
|
39
40
|
message << "Ambiguous match of \"#{step_name}\":\n\n"
|
40
41
|
message << step_definitions.map(&:backtrace_line).join("\n")
|
41
42
|
message << "\n\n"
|
@@ -6,8 +6,7 @@ module Cucumber
|
|
6
6
|
module Events
|
7
7
|
# Event fired when a TestStep is created from a PickleStep
|
8
8
|
class TestStepCreated < Core::Event.new(:test_step, :pickle_step)
|
9
|
-
attr_reader :test_step
|
10
|
-
attr_reader :pickle_step
|
9
|
+
attr_reader :test_step, :pickle_step
|
11
10
|
end
|
12
11
|
end
|
13
12
|
end
|
@@ -1,10 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'cucumber/core/events'
|
2
4
|
|
3
5
|
module Cucumber
|
4
6
|
module Events
|
5
7
|
class UndefinedParameterType < Core::Event.new(:type_name, :expression)
|
6
|
-
attr_reader :type_name
|
7
|
-
attr_reader :expression
|
8
|
+
attr_reader :type_name, :expression
|
8
9
|
end
|
9
10
|
end
|
10
11
|
end
|
data/lib/cucumber/events.rb
CHANGED
data/lib/cucumber/file_specs.rb
CHANGED
@@ -5,7 +5,7 @@ require 'cucumber/core/test/location'
|
|
5
5
|
|
6
6
|
module Cucumber
|
7
7
|
class FileSpecs
|
8
|
-
FILE_COLON_LINE_PATTERN = /^([\w\W]*?)(?::([\d:]+))
|
8
|
+
FILE_COLON_LINE_PATTERN = /^([\w\W]*?)(?::([\d:]+))?$/.freeze # :nodoc:
|
9
9
|
|
10
10
|
def initialize(file_specs)
|
11
11
|
Cucumber.logger.debug("Features:\n")
|
@@ -32,6 +32,7 @@ module Cucumber
|
|
32
32
|
|
33
33
|
def locations
|
34
34
|
return [Core::Test::Location.new(@file)] if @lines.empty?
|
35
|
+
|
35
36
|
@lines.map { |line| Core::Test::Location.new(@file, line) }
|
36
37
|
end
|
37
38
|
end
|
@@ -7,6 +7,11 @@ require 'cucumber/events'
|
|
7
7
|
module Cucumber
|
8
8
|
module Filters
|
9
9
|
class Retry < Core::Filter.new(:configuration)
|
10
|
+
def initialize(*_args)
|
11
|
+
super
|
12
|
+
@total_permanently_failed = 0
|
13
|
+
end
|
14
|
+
|
10
15
|
def test_case(test_case)
|
11
16
|
configuration.on_event(:test_case_finished) do |event|
|
12
17
|
next unless retry_required?(test_case, event)
|
@@ -21,7 +26,21 @@ module Cucumber
|
|
21
26
|
private
|
22
27
|
|
23
28
|
def retry_required?(test_case, event)
|
24
|
-
|
29
|
+
return false unless event.test_case == test_case
|
30
|
+
|
31
|
+
return false unless event.result.failed?
|
32
|
+
|
33
|
+
return false if @total_permanently_failed >= configuration.retry_total_tests
|
34
|
+
|
35
|
+
retry_required = test_case_counts[test_case] < configuration.retry_attempts
|
36
|
+
if retry_required
|
37
|
+
# retry test
|
38
|
+
true
|
39
|
+
else
|
40
|
+
# test failed after max. attempts
|
41
|
+
@total_permanently_failed += 1
|
42
|
+
false
|
43
|
+
end
|
25
44
|
end
|
26
45
|
|
27
46
|
def test_case_counts
|
@@ -3,21 +3,48 @@
|
|
3
3
|
require 'cucumber/platform'
|
4
4
|
require 'cucumber/term/ansicolor'
|
5
5
|
|
6
|
-
Cucumber::Term::ANSIColor.coloring = false
|
6
|
+
Cucumber::Term::ANSIColor.coloring = false unless $stdout.tty?
|
7
7
|
|
8
8
|
module Cucumber
|
9
9
|
module Formatter
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
#
|
14
|
-
#
|
10
|
+
# This module allows to format cucumber related outputs using ANSI escape sequences.
|
11
|
+
#
|
12
|
+
# For example, it provides a `passed` method which returns the string with
|
13
|
+
# the ANSI escape sequence to format it green per default.
|
14
|
+
#
|
15
|
+
# To use this, include or extend it in your class.
|
16
|
+
#
|
17
|
+
# Example:
|
18
|
+
#
|
19
|
+
# require 'cucumber/formatter/ansicolor'
|
20
|
+
#
|
21
|
+
# class MyFormatter
|
22
|
+
# extend Cucumber::Term::ANSIColor
|
23
|
+
#
|
24
|
+
# def on_test_step_finished(event)
|
25
|
+
# $stdout.puts undefined(event.test_step) if event.result.undefined?
|
26
|
+
# $stdout.puts passed(event.test_step) if event.result.passed?
|
27
|
+
# end
|
28
|
+
# end
|
29
|
+
#
|
30
|
+
# This module also allows the user to customize the format of cucumber outputs
|
31
|
+
# using environment variables.
|
32
|
+
#
|
33
|
+
# For instance, if your shell has a black background and a green font (like the
|
34
|
+
# "Homebrew" settings for OS X' Terminal.app), you may want to override passed
|
35
|
+
# steps to be white instead of green.
|
36
|
+
#
|
37
|
+
# Example:
|
38
|
+
#
|
39
|
+
# export CUCUMBER_COLORS="passed=white,bold:passed_param=white,bold,underline"
|
15
40
|
#
|
16
41
|
# The colours that you can change are:
|
17
42
|
#
|
18
43
|
# * <tt>undefined</tt> - defaults to <tt>yellow</tt>
|
19
44
|
# * <tt>pending</tt> - defaults to <tt>yellow</tt>
|
20
45
|
# * <tt>pending_param</tt> - defaults to <tt>yellow,bold</tt>
|
46
|
+
# * <tt>flaky</tt> - defaults to <tt>yellow</tt>
|
47
|
+
# * <tt>flaky_param</tt> - defaults to <tt>yellow,bold</tt>
|
21
48
|
# * <tt>failed</tt> - defaults to <tt>red</tt>
|
22
49
|
# * <tt>failed_param</tt> - defaults to <tt>red,bold</tt>
|
23
50
|
# * <tt>passed</tt> - defaults to <tt>green</tt>
|
@@ -29,46 +56,39 @@ module Cucumber
|
|
29
56
|
# * <tt>comment</tt> - defaults to <tt>grey</tt>
|
30
57
|
# * <tt>tag</tt> - defaults to <tt>cyan</tt>
|
31
58
|
#
|
32
|
-
# For instance, if your shell has a black background and a green font (like the
|
33
|
-
# "Homebrew" settings for OS X' Terminal.app), you may want to override passed
|
34
|
-
# steps to be white instead of green.
|
35
|
-
#
|
36
|
-
# Although not listed, you can also use <tt>grey</tt>.
|
37
|
-
#
|
38
|
-
# Examples: (On Windows, use SET instead of export.)
|
39
|
-
#
|
40
|
-
# export CUCUMBER_COLORS="passed=white"
|
41
|
-
# export CUCUMBER_COLORS="passed=white,bold:passed_param=white,bold,underline"
|
42
|
-
#
|
43
59
|
# To see what colours and effects are available, just run this in your shell:
|
44
60
|
#
|
45
|
-
# ruby -e "require 'rubygems'; require 'term/ansicolor'; puts Cucumber::Term::ANSIColor.attributes"
|
61
|
+
# ruby -e "require 'rubygems'; require 'cucumber/term/ansicolor'; puts Cucumber::Term::ANSIColor.attributes"
|
46
62
|
#
|
47
63
|
module ANSIColor
|
48
64
|
include Cucumber::Term::ANSIColor
|
49
65
|
|
50
66
|
ALIASES = Hash.new do |h, k|
|
51
|
-
|
67
|
+
next unless k.to_s =~ /(.*)_param/
|
68
|
+
|
69
|
+
"#{h[Regexp.last_match(1)]},bold"
|
52
70
|
end.merge(
|
53
71
|
'undefined' => 'yellow',
|
54
|
-
'pending'
|
55
|
-
'flaky'
|
56
|
-
'failed'
|
57
|
-
'passed'
|
58
|
-
'outline'
|
59
|
-
'skipped'
|
60
|
-
'comment'
|
61
|
-
'tag'
|
72
|
+
'pending' => 'yellow',
|
73
|
+
'flaky' => 'yellow',
|
74
|
+
'failed' => 'red',
|
75
|
+
'passed' => 'green',
|
76
|
+
'outline' => 'cyan',
|
77
|
+
'skipped' => 'cyan',
|
78
|
+
'comment' => 'grey',
|
79
|
+
'tag' => 'cyan'
|
62
80
|
)
|
63
81
|
|
64
|
-
|
65
|
-
|
82
|
+
# Apply the custom color scheme -> i.e. apply_custom_colors('passed=white')
|
83
|
+
def self.apply_custom_colors(colors)
|
84
|
+
colors.split(':').each do |pair|
|
66
85
|
a = pair.split('=')
|
67
86
|
ALIASES[a[0]] = a[1]
|
68
87
|
end
|
69
88
|
end
|
89
|
+
apply_custom_colors(ENV['CUCUMBER_COLORS']) if ENV['CUCUMBER_COLORS']
|
70
90
|
|
71
|
-
#
|
91
|
+
# Define the color-named methods required by Term::ANSIColor.
|
72
92
|
#
|
73
93
|
# Examples:
|
74
94
|
#
|
@@ -80,67 +100,39 @@ module Cucumber
|
|
80
100
|
# red(bold(string, &proc)) + red
|
81
101
|
# end
|
82
102
|
ALIASES.each_key do |method_name|
|
83
|
-
next if method_name
|
84
|
-
code = <<-COLOR
|
85
|
-
def #{method_name}(string=nil, &proc)
|
86
|
-
#{ALIASES[method_name].split(',').join('(') + '(string, &proc' + ')' * ALIASES[method_name].split(',').length}
|
87
|
-
end
|
88
|
-
# This resets the colour to the non-param colour
|
89
|
-
def #{method_name}_param(string=nil, &proc)
|
90
|
-
#{ALIASES[method_name + '_param'].split(',').join('(') + '(string, &proc' + ')' * ALIASES[method_name + '_param'].split(',').length} + #{ALIASES[method_name].split(',').join(' + ')}
|
91
|
-
end
|
92
|
-
COLOR
|
93
|
-
eval(code) # rubocop:disable Security/Eval
|
94
|
-
end
|
103
|
+
next if method_name.end_with?('_param')
|
95
104
|
|
96
|
-
|
97
|
-
|
98
|
-
require 'terminfo'
|
99
|
-
case TermInfo.default_object.tigetnum('colors')
|
100
|
-
when 0
|
101
|
-
raise "Your terminal doesn't support colours."
|
102
|
-
when 1
|
103
|
-
::Cucumber::Term::ANSIColor.coloring = false
|
104
|
-
alias_method :grey, :white
|
105
|
-
when 2..8
|
106
|
-
alias_method :grey, :white # rubocop:disable Lint/DuplicateMethods
|
107
|
-
else
|
108
|
-
define_real_grey
|
105
|
+
define_method(method_name) do |text = nil, &proc|
|
106
|
+
apply_styles(ALIASES[method_name], text, &proc)
|
109
107
|
end
|
110
|
-
rescue Exception => e # rubocop:disable Lint/RescueException
|
111
|
-
if e.class.name == 'TermInfo::TermInfoError'
|
112
|
-
STDERR.puts '*** WARNING ***'
|
113
|
-
STDERR.puts "You have the genki-ruby-terminfo gem installed, but you haven't set your TERM variable."
|
114
|
-
STDERR.puts 'Try setting it to TERM=xterm-256color to get grey colour in output.'
|
115
|
-
STDERR.puts "\n"
|
116
|
-
alias_method :grey, :white
|
117
|
-
else
|
118
|
-
define_real_grey
|
119
|
-
end
|
120
|
-
end
|
121
108
|
|
122
|
-
|
123
|
-
|
124
|
-
::Cucumber::Term::ANSIColor.coloring? ? "\e[90m#{string}\e[0m" : string
|
109
|
+
define_method("#{method_name}_param") do |text = nil, &proc|
|
110
|
+
apply_styles(ALIASES["#{method_name}_param"], text, &proc) + apply_styles(ALIASES[method_name])
|
125
111
|
end
|
126
112
|
end
|
127
113
|
|
128
|
-
|
114
|
+
def cukes(amount)
|
115
|
+
('(::) ' * amount).strip
|
116
|
+
end
|
129
117
|
|
130
|
-
def
|
131
|
-
(
|
118
|
+
def green_cukes(amount)
|
119
|
+
blink(green(cukes(amount)))
|
132
120
|
end
|
133
121
|
|
134
|
-
def
|
135
|
-
blink(
|
122
|
+
def red_cukes(amount)
|
123
|
+
blink(red(cukes(amount)))
|
136
124
|
end
|
137
125
|
|
138
|
-
def
|
139
|
-
blink(
|
126
|
+
def yellow_cukes(amount)
|
127
|
+
blink(yellow(cukes(amount)))
|
140
128
|
end
|
141
129
|
|
142
|
-
|
143
|
-
|
130
|
+
private
|
131
|
+
|
132
|
+
def apply_styles(styles, text = nil, &proc)
|
133
|
+
styles.split(',').reverse.reduce(text) do |result, method_name|
|
134
|
+
send(method_name, result, &proc)
|
135
|
+
end
|
144
136
|
end
|
145
137
|
end
|
146
138
|
end
|
@@ -45,11 +45,11 @@ module Cucumber
|
|
45
45
|
break
|
46
46
|
end
|
47
47
|
break if node.previous_node.nil?
|
48
|
+
|
48
49
|
node = node.previous_node
|
49
50
|
end
|
50
51
|
keyword = dialect.given_keywords.reject { |kw| kw == '* ' }[0] if keyword.nil?
|
51
|
-
|
52
|
-
keyword
|
52
|
+
Cucumber::Gherkin::I18n.code_keyword_for(keyword)
|
53
53
|
end
|
54
54
|
|
55
55
|
ScenarioSource = Struct.new(:type, :scenario)
|
@@ -112,16 +112,24 @@ module Cucumber
|
|
112
112
|
if child.respond_to?(:rule) && child.rule
|
113
113
|
process_scenario_container(child.rule)
|
114
114
|
elsif child.respond_to?(:scenario) && child.scenario
|
115
|
-
child.scenario
|
116
|
-
@lookup_hash[step.location.line] = StepSource.new(:Step, step)
|
117
|
-
end
|
115
|
+
store_scenario_source_steps(child.scenario)
|
118
116
|
elsif !child.background.nil?
|
119
|
-
child.background
|
120
|
-
@lookup_hash[step.location.line] = StepSource.new(:Step, step)
|
121
|
-
end
|
117
|
+
store_background_source_steps(child.background)
|
122
118
|
end
|
123
119
|
end
|
124
120
|
end
|
121
|
+
|
122
|
+
def store_scenario_source_steps(scenario)
|
123
|
+
scenario.steps.each do |step|
|
124
|
+
@lookup_hash[step.location.line] = StepSource.new(:Step, step)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
def store_background_source_steps(background)
|
129
|
+
background.steps.each do |step|
|
130
|
+
@lookup_hash[step.location.line] = StepSource.new(:Step, step)
|
131
|
+
end
|
132
|
+
end
|
125
133
|
end
|
126
134
|
|
127
135
|
KeywordSearchNode = Struct.new(:keyword, :previous_node)
|
@@ -22,6 +22,7 @@ module Cucumber
|
|
22
22
|
@backtrace_filters << RbConfig::CONFIG['rubylibdir'] if RbConfig::CONFIG['rubylibdir']
|
23
23
|
|
24
24
|
@backtrace_filters << 'org/jruby/' if ::Cucumber::JRUBY
|
25
|
+
@backtrace_filters << '<internal:' if RUBY_ENGINE == 'truffleruby'
|
25
26
|
|
26
27
|
BACKTRACE_FILTER_PATTERNS = Regexp.new(@backtrace_filters.join('|'))
|
27
28
|
|
@@ -33,7 +34,7 @@ module Cucumber
|
|
33
34
|
def exception
|
34
35
|
return @exception if ::Cucumber.use_full_backtrace
|
35
36
|
|
36
|
-
pwd_pattern = /#{::Regexp.escape(::Dir.pwd)}\//m
|
37
|
+
pwd_pattern = /#{::Regexp.escape(::Dir.pwd)}\//m
|
37
38
|
backtrace = @exception.backtrace.map { |line| line.gsub(pwd_pattern, './') }
|
38
39
|
|
39
40
|
filtered = (backtrace || []).reject do |line|
|