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.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +73 -0
  3. data/CONTRIBUTING.md +3 -3
  4. data/README.md +0 -2
  5. data/lib/cucumber/core.rb +8 -6
  6. data/lib/cucumber/core/compiler.rb +35 -14
  7. data/lib/cucumber/core/event.rb +3 -5
  8. data/lib/cucumber/core/event_bus.rb +1 -1
  9. data/lib/cucumber/core/events.rb +25 -1
  10. data/lib/cucumber/core/gherkin/parser.rb +10 -8
  11. data/lib/cucumber/core/gherkin/writer.rb +15 -5
  12. data/lib/cucumber/core/gherkin/writer/helpers.rb +2 -2
  13. data/lib/cucumber/core/test/action.rb +1 -2
  14. data/lib/cucumber/core/test/case.rb +5 -4
  15. data/lib/cucumber/core/test/data_table.rb +6 -10
  16. data/lib/cucumber/core/test/doc_string.rb +3 -6
  17. data/lib/cucumber/core/test/filters/activate_steps_for_self_test.rb +0 -1
  18. data/lib/cucumber/core/test/result.rb +68 -7
  19. data/lib/cucumber/core/test/step.rb +6 -5
  20. data/lib/cucumber/core/test/timer.rb +2 -2
  21. data/lib/cucumber/core/version.rb +1 -1
  22. data/spec/coverage.rb +1 -0
  23. data/spec/cucumber/core/compiler_spec.rb +66 -3
  24. data/spec/cucumber/core/event_bus_spec.rb +2 -2
  25. data/spec/cucumber/core/event_spec.rb +3 -3
  26. data/spec/cucumber/core/filter_spec.rb +2 -2
  27. data/spec/cucumber/core/gherkin/parser_spec.rb +18 -2
  28. data/spec/cucumber/core/gherkin/writer_spec.rb +0 -1
  29. data/spec/cucumber/core/test/action_spec.rb +1 -2
  30. data/spec/cucumber/core/test/case_spec.rb +3 -2
  31. data/spec/cucumber/core/test/data_table_spec.rb +10 -12
  32. data/spec/cucumber/core/test/doc_string_spec.rb +8 -11
  33. data/spec/cucumber/core/test/location_spec.rb +7 -7
  34. data/spec/cucumber/core/test/result_spec.rb +41 -11
  35. data/spec/cucumber/core/test/runner_spec.rb +23 -21
  36. data/spec/cucumber/core/test/step_spec.rb +10 -9
  37. data/spec/cucumber/core_spec.rb +2 -2
  38. metadata +91 -53
  39. data/spec/capture_warnings.rb +0 -74
@@ -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