cucumber-core 5.0.2 → 9.0.0
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/CHANGELOG.md +73 -0
- data/CONTRIBUTING.md +3 -3
- data/README.md +0 -2
- data/lib/cucumber/core.rb +8 -6
- data/lib/cucumber/core/compiler.rb +35 -14
- data/lib/cucumber/core/event.rb +3 -5
- data/lib/cucumber/core/event_bus.rb +1 -1
- data/lib/cucumber/core/events.rb +25 -1
- data/lib/cucumber/core/gherkin/parser.rb +10 -8
- data/lib/cucumber/core/gherkin/writer.rb +15 -5
- data/lib/cucumber/core/gherkin/writer/helpers.rb +2 -2
- data/lib/cucumber/core/test/action.rb +1 -2
- data/lib/cucumber/core/test/case.rb +5 -4
- data/lib/cucumber/core/test/data_table.rb +6 -10
- data/lib/cucumber/core/test/doc_string.rb +3 -6
- data/lib/cucumber/core/test/filters/activate_steps_for_self_test.rb +0 -1
- data/lib/cucumber/core/test/result.rb +68 -7
- data/lib/cucumber/core/test/step.rb +6 -5
- data/lib/cucumber/core/test/timer.rb +2 -2
- data/lib/cucumber/core/version.rb +1 -1
- data/spec/coverage.rb +1 -0
- data/spec/cucumber/core/compiler_spec.rb +66 -3
- data/spec/cucumber/core/event_bus_spec.rb +2 -2
- data/spec/cucumber/core/event_spec.rb +3 -3
- data/spec/cucumber/core/filter_spec.rb +2 -2
- data/spec/cucumber/core/gherkin/parser_spec.rb +18 -2
- data/spec/cucumber/core/gherkin/writer_spec.rb +0 -1
- data/spec/cucumber/core/test/action_spec.rb +1 -2
- data/spec/cucumber/core/test/case_spec.rb +3 -2
- data/spec/cucumber/core/test/data_table_spec.rb +10 -12
- data/spec/cucumber/core/test/doc_string_spec.rb +8 -11
- data/spec/cucumber/core/test/location_spec.rb +7 -7
- data/spec/cucumber/core/test/result_spec.rb +41 -11
- data/spec/cucumber/core/test/runner_spec.rb +23 -21
- data/spec/cucumber/core/test/step_spec.rb +10 -9
- data/spec/cucumber/core_spec.rb +2 -2
- metadata +91 -53
- data/spec/capture_warnings.rb +0 -74
data/spec/capture_warnings.rb
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
# With thanks to @myronmarston
|
3
|
-
# https://github.com/vcr/vcr/blob/master/spec/capture_warnings.rb
|
4
|
-
|
5
|
-
module CaptureWarnings
|
6
|
-
def report_warnings(&block)
|
7
|
-
current_dir = Dir.pwd
|
8
|
-
warnings, errors = capture_error(&block).partition { |line| line.include?('warning') }
|
9
|
-
project_warnings, other_warnings = warnings.uniq.partition { |line| line.include?(current_dir) && !line.include?('/vendor/') }
|
10
|
-
|
11
|
-
if errors.any?
|
12
|
-
puts errors.join("\n")
|
13
|
-
end
|
14
|
-
|
15
|
-
if other_warnings.any?
|
16
|
-
puts "#{ other_warnings.count } non-cucumber-core warnings detected, set VIEW_OTHER_WARNINGS=true to see them."
|
17
|
-
print_warnings('other', other_warnings) if ENV['VIEW_OTHER_WARNINGS']
|
18
|
-
end
|
19
|
-
|
20
|
-
# Until they fix https://bugs.ruby-lang.org/issues/10661
|
21
|
-
if RUBY_VERSION == "2.2.0"
|
22
|
-
project_warnings = project_warnings.reject { |w| w =~ /warning: possible reference to past scope/ }
|
23
|
-
end
|
24
|
-
|
25
|
-
if project_warnings.any?
|
26
|
-
puts "#{ project_warnings.count } cucumber-core warnings detected"
|
27
|
-
print_warnings('cucumber-core', project_warnings)
|
28
|
-
fail "Please remove all cucumber-core warnings."
|
29
|
-
end
|
30
|
-
|
31
|
-
ensure_system_exit_if_required
|
32
|
-
end
|
33
|
-
|
34
|
-
def capture_error(&block)
|
35
|
-
old_stderr = STDERR.clone
|
36
|
-
pipe_r, pipe_w = IO.pipe
|
37
|
-
pipe_r.sync = true
|
38
|
-
error = String.new
|
39
|
-
reader = Thread.new do
|
40
|
-
begin
|
41
|
-
loop do
|
42
|
-
error << pipe_r.readpartial(1024)
|
43
|
-
end
|
44
|
-
rescue EOFError
|
45
|
-
end
|
46
|
-
end
|
47
|
-
STDERR.reopen(pipe_w)
|
48
|
-
block.call
|
49
|
-
ensure
|
50
|
-
capture_system_exit
|
51
|
-
STDERR.reopen(old_stderr)
|
52
|
-
pipe_w.close
|
53
|
-
reader.join
|
54
|
-
return error.split("\n")
|
55
|
-
end
|
56
|
-
|
57
|
-
def print_warnings(type, warnings)
|
58
|
-
puts
|
59
|
-
puts "-" * 30 + " #{type} warnings: " + "-" * 30
|
60
|
-
puts
|
61
|
-
puts warnings.join("\n")
|
62
|
-
puts
|
63
|
-
puts "-" * 75
|
64
|
-
puts
|
65
|
-
end
|
66
|
-
|
67
|
-
def ensure_system_exit_if_required
|
68
|
-
raise @system_exit if @system_exit
|
69
|
-
end
|
70
|
-
|
71
|
-
def capture_system_exit
|
72
|
-
@system_exit = $!
|
73
|
-
end
|
74
|
-
end
|