cucumber 8.0.0 → 9.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +14 -23
  3. data/VERSION +1 -0
  4. data/lib/cucumber/cli/main.rb +1 -1
  5. data/lib/cucumber/cli/options.rb +66 -66
  6. data/lib/cucumber/cli/profile_loader.rb +5 -5
  7. data/lib/cucumber/configuration.rb +7 -2
  8. data/lib/cucumber/deprecate.rb +6 -47
  9. data/lib/cucumber/errors.rb +2 -1
  10. data/lib/cucumber/events/envelope.rb +2 -0
  11. data/lib/cucumber/events/gherkin_source_parsed.rb +2 -0
  12. data/lib/cucumber/events/gherkin_source_read.rb +2 -0
  13. data/lib/cucumber/events/test_case_finished.rb +2 -0
  14. data/lib/cucumber/events/test_case_started.rb +2 -0
  15. data/lib/cucumber/events/test_step_finished.rb +2 -0
  16. data/lib/cucumber/events/test_step_started.rb +2 -0
  17. data/lib/cucumber/events/undefined_parameter_type.rb +2 -0
  18. data/lib/cucumber/file_specs.rb +1 -1
  19. data/lib/cucumber/filters/retry.rb +20 -1
  20. data/lib/cucumber/formatter/ansicolor.rb +19 -27
  21. data/lib/cucumber/formatter/ast_lookup.rb +14 -6
  22. data/lib/cucumber/formatter/console.rb +16 -14
  23. data/lib/cucumber/formatter/console_counts.rb +3 -1
  24. data/lib/cucumber/formatter/console_issues.rb +4 -2
  25. data/lib/cucumber/formatter/curl_option_parser.rb +49 -0
  26. data/lib/cucumber/formatter/errors.rb +2 -0
  27. data/lib/cucumber/formatter/fail_fast.rb +1 -1
  28. data/lib/cucumber/formatter/html.rb +2 -0
  29. data/lib/cucumber/formatter/http_io.rb +10 -142
  30. data/lib/cucumber/formatter/io_http_buffer.rb +88 -0
  31. data/lib/cucumber/formatter/json.rb +2 -6
  32. data/lib/cucumber/formatter/junit.rb +4 -4
  33. data/lib/cucumber/formatter/message_builder.rb +21 -6
  34. data/lib/cucumber/formatter/pretty.rb +9 -5
  35. data/lib/cucumber/formatter/publish_banner_printer.rb +0 -2
  36. data/lib/cucumber/formatter/query/hook_by_test_step.rb +2 -0
  37. data/lib/cucumber/formatter/query/pickle_by_test.rb +2 -0
  38. data/lib/cucumber/formatter/query/pickle_step_by_test_step.rb +2 -0
  39. data/lib/cucumber/formatter/query/step_definitions_by_test_step.rb +2 -0
  40. data/lib/cucumber/formatter/query/test_case_started_by_test_case.rb +2 -0
  41. data/lib/cucumber/formatter/rerun.rb +3 -3
  42. data/lib/cucumber/formatter/unicode.rb +3 -3
  43. data/lib/cucumber/formatter/url_reporter.rb +3 -1
  44. data/lib/cucumber/gherkin/formatter/ansi_escapes.rb +23 -25
  45. data/lib/cucumber/glue/invoke_in_world.rb +2 -2
  46. data/lib/cucumber/glue/proto_world.rb +20 -25
  47. data/lib/cucumber/glue/registry_and_more.rb +9 -5
  48. data/lib/cucumber/glue/snippet.rb +4 -2
  49. data/lib/cucumber/glue/world_factory.rb +2 -0
  50. data/lib/cucumber/multiline_argument/data_table/diff_matrices.rb +2 -0
  51. data/lib/cucumber/multiline_argument/data_table.rb +34 -35
  52. data/lib/cucumber/platform.rb +11 -16
  53. data/lib/cucumber/rake/task.rb +2 -6
  54. data/lib/cucumber/running_test_case.rb +1 -1
  55. data/lib/cucumber/runtime/for_programming_languages.rb +1 -2
  56. data/lib/cucumber/runtime/meta_message_builder.rb +4 -2
  57. data/lib/cucumber/runtime/user_interface.rb +2 -2
  58. data/lib/cucumber/runtime.rb +5 -5
  59. data/lib/cucumber/step_match.rb +1 -1
  60. data/lib/cucumber/term/ansicolor.rb +1 -1
  61. data/lib/cucumber/term/banner.rb +2 -0
  62. metadata +83 -239
  63. data/CHANGELOG.md +0 -3231
  64. data/CONTRIBUTING.md +0 -246
  65. data/lib/autotest/cucumber.rb +0 -8
  66. data/lib/autotest/cucumber_mixin.rb +0 -133
  67. data/lib/autotest/cucumber_rails.rb +0 -8
  68. data/lib/autotest/cucumber_rails_rspec.rb +0 -8
  69. data/lib/autotest/cucumber_rails_rspec2.rb +0 -8
  70. data/lib/autotest/cucumber_rspec.rb +0 -8
  71. data/lib/autotest/cucumber_rspec2.rb +0 -8
  72. data/lib/autotest/discover.rb +0 -14
  73. data/lib/cucumber/version +0 -1
data/CONTRIBUTING.md DELETED
@@ -1,246 +0,0 @@
1
- # Contributing to Cucumber
2
-
3
- Thank you for considering contributing to Cucumber!
4
-
5
- This document will first introduce different ways to get involved before
6
- focusing on how to contribute to the code.
7
-
8
- ## Code of Conduct
9
-
10
- Everyone interacting in this codebase and issue tracker is expected to follow
11
- the Cucumber [code of conduct](https://cucumber.io/conduct).
12
-
13
- ## How can I contribute?
14
-
15
- If you're reading this, you are certainly looking to contribute to the code. Cucumber
16
- is not this single repository. It is made up of several packages around several
17
- repositories. So before going further with the code, you may consider the
18
- following first, in order to get your bearings.
19
-
20
- If you just want to know how to contribute to the code, go to
21
- [Contribute to the code](#contribute-to-the-code).
22
-
23
- If you want to report an issue, or suggest an enhancement, go to
24
- [Report bugs and submit feature requests](#report-bugs-and-submit-feature-requests).
25
-
26
- ### Meet the community, the maintainers, and other Cucumber developers
27
-
28
- Smartbear hosts a [community message board].
29
- This is a good place to meet users, the community, and to ask questions.
30
-
31
- You can also join the Cucumber Community Slack:
32
- [register for an account][register-slack] then head over to [#intro][slack-intro].
33
- This is the place to be to meet other contributors and find a mentor to help you
34
- get started.
35
-
36
- ### Test Cucumber
37
-
38
- Testing Cucumber, especially new features, is a great way to contribute. We
39
- cannot put a price on (early) feedback.
40
-
41
- Keep an eye on our CHANGELOGS to discover new features. Test and experiment, and
42
- submit your feedback through [issues](#report-bugs-and-submit-feature-requests),
43
- the [community message board], or [Slack][community-slack].
44
-
45
- ### Contribute to the documentation
46
-
47
- [The documentation][cucumber-docs] is an important part of Cucumber. It is
48
- essential that it remains simple and accurate. You can contribute to it via
49
- [github.com/cucumber/docs](https://github.com/cucumber/docs).
50
-
51
- ### Promote Cucumber
52
-
53
- You don't know how to contribute but would like to help? Telling other people
54
- about Cucumber on the Internet - social media, reviews, blogs - but also in real
55
- life is already a big help! Join us on [Slack][community-slack] to share your
56
- publication and to discover new ones.
57
-
58
- ## Report bugs and submit feature requests
59
-
60
- The short version is:
61
-
62
- - Find the appropriate repository
63
- - Try to check there is not already an issue or pull request that deals with
64
- your bug or request
65
- - Explain your issue and include as much details as possible to help other
66
- people reproduce your problem or understand your request
67
- - Consider submitting a pull request if you feel confident enough
68
-
69
- You can find more details for each of these steps in the following sections.
70
-
71
- ### Find the appropriate repository
72
-
73
- The current repository, `cucumber-ruby`, is actually the tip of the iceberg. It
74
- provides a user interface through a CLI, some built-in formatters, and the
75
- execution environment you may know as the `World` object.
76
-
77
- An important repository is [cucumber/common]. It is a mono-repo
78
- with a lot of libraries. You will find there what is related to:
79
-
80
- - parsing Gherkin documents - aka `.feature` files
81
- - parsing tag expressions - the options you use to filter an execution with tags
82
- - parsing Cucumber expressions - the expressions that link a Gherkin step to a
83
- step definition
84
- - everyting related to the HTML formatter
85
-
86
- `cucumber-ruby` is also composed of [cucumber-ruby-core]: this is the engine that
87
- will execute the test cases computed from a parsed Gherkin document
88
-
89
- Last but not least, there is also a repository for [cucumber-rails], the gem
90
- that brings Cucumber to Rails 5.x and 6.x.
91
-
92
- In any case, if your are not sure, best places to open an issue are the current
93
- repository - `cucumber-ruby` - and the mono-repo at [cucumber/common].
94
-
95
- ### Look for existing issues and pull requests
96
-
97
- Search in [the current repository][cucumber-ruby-issues], in the
98
- [mono-repo][cucumber/common-issues], but also in the
99
- [whole cucumber organization][cucumber-issues] if the problem or feature has already
100
- been reported. If you find an issue or pull request which is still open, add
101
- comments to it instead of opening a new one.
102
-
103
- If you're not sure, don't hesitate to just open a new issue. We can always merge
104
- and de-duplicate later.
105
-
106
- ### Submitting a pull request
107
-
108
- When submitting a pull request:
109
-
110
- - create a [draft pull request][how-to-create-a-draft-pr]
111
- - try to follow the instructions in the [template](.github/PULL_REQUEST_TEMPLATE.md)
112
- - if possible, [sign your commits]
113
- - update CHANGELOG.md with your changes
114
- - once the PR is ready, request for reviews
115
-
116
- More info on [how to contribute to the code](#contribute-to-the-code) can be
117
- found below.
118
-
119
- ### Opening a new issue
120
-
121
- To open a good issue, be clear and precise.
122
-
123
- If you report a problem, the reader must be able to reproduce it easily.
124
- Please do your best to create a [minimal, reproducible example][minimal-reproducible-example].
125
-
126
- Consider submitting a pull request. Even if you think you cannot fix it by
127
- yourself, a pull request with a failing test is always welcome.
128
-
129
- If you request is for an enhancement - a new feature - try to be specific and
130
- support your request with referenced facts and include examples to illustrate
131
- your proposal.
132
-
133
- ## Contribute to the code
134
-
135
- ### Development environment
136
-
137
- Development environment for `cucumber-ruby` is a simple Ruby environment with
138
- Bundler. Use a [supported Ruby version](./README.md#supported-platforms), make
139
- sure [Bundler] is set-up, and voilà!
140
-
141
- You can then [fork][how-to-fork] and clone the repository. If your environment
142
- is set-up properly, the following commands should install the dependencies and
143
- execute all the tests successfully.
144
-
145
- ```shell
146
- bundle install
147
- bundle exec rake
148
- ```
149
-
150
- You can now create a branch for your changes and [submit a pull request](#submitting-a-pull-request)!
151
-
152
- If you want to check the code coverage during your development, execute
153
- `bundle exec rake cov`.
154
-
155
- ### Cucumber-ruby-core
156
-
157
- As seen here: [Find the appropriate repository](#find-the-appropriate-repository),
158
- you may need to work with other repositories in order to accomplish your
159
- development. Beside the mono-repo in [cucumber/common], [cucumber-ruby-core] is
160
- also a big piece of `cucumber-ruby`.
161
-
162
- ### Using a local Gemfile
163
-
164
- A local Gemfile allows you to use your prefer set of gems for your own
165
- development workflow, like gems dedicated to debugging. Such gems are not part
166
- of `cucumber-ruby` standard `Gemfile`.
167
-
168
- `Gemfile.local`, `Gemfile.local.lock` and `.bundle` have been added to
169
- `.gitignore` so local changes cannot be accidentaly commited and pushed to the
170
- repository.
171
-
172
- A `Gemfile.local` may look like this:
173
-
174
- ```ruby
175
- # Gemfile.local
176
-
177
- # Include the regular Gemfile
178
- eval File.read('Gemfile')
179
-
180
- # Include your favorites development gems
181
- group :development do
182
- gem 'byebug'
183
- gem 'pry'
184
- gem 'pry-byebug'
185
-
186
- gem 'debase', require: false
187
- gem 'ruby-debug-ide', require: false
188
- end
189
- ```
190
-
191
- Then you can execute bundler with the `--gemfile` flag:
192
- `bundle install --gemfile Gemfile.local`, or with an environment variable:
193
- `BUNDLE_GEMFILE=Gemfile.local bundle [COMMAND]`.
194
-
195
- To use your local Gemfile per default, you can also execute
196
- `bundle config set --local gemfile Gemfile.local`.
197
-
198
- ### First timer? Welcome!
199
-
200
- Looking for something simple to begin with? Look at issues with the label
201
- '[good first issue](https://github.com/cucumber/cucumber-ruby/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22)'.
202
-
203
- Remember: Cucumber is more than `cucumber-ruby`. You can look for good first
204
- issues in [other cucumber reporistories](#find-the-appropriate-repository).
205
-
206
- ### Having trouble getting started with the code? We're here to help!
207
-
208
- If you have trouble setting-up your development environment, or getting started
209
- with the code, you can join us on [Slack][community-slack]. You will find there
210
- a lot of contributors.
211
-
212
- Full-time maintainers are also available. We would be please to have 1:1 pairing
213
- sessions to help you getting started. Look for
214
- [Matt Wynne](https://cucumberbdd.slack.com/team/U590XDLF3) or
215
- [Aurélien Reeves](https://cucumberbdd.slack.com/team/U011BB95MC7) on
216
- [Slack][community-slack].
217
-
218
- ### Additional documentation and notice
219
-
220
- You can find additional documentation in the [docs](./docs) directory such as
221
- (non-exhaustive list):
222
-
223
- - [How to release cucumber-ruby](./docs/RELEASE_PROCESS.md) (for maintainers)
224
- - [How to set-up a launch.json configuration for Visual Studio Code](./docs/vscode-example-launch-configuration.md)
225
-
226
-
227
- <!-- Links -->
228
-
229
- [community message board]: https://community.smartbear.com/t5/Cucumber-Open/bd-p/CucumberOS
230
- [register-slack]: https://cucumberbdd-slack-invite.herokuapp.com/
231
- [slack-intro]: https://cucumberbdd.slack.com/messages/C5WD8SA21/
232
- [community-slack]: https://cucumberbdd.slack.com/
233
- [cucumber-docs]: https://cucumber.io/docs/cucumber
234
- [cucumber/common]: https://github.com/cucumber/common
235
- [cucumber-ruby-core]: https://github.com/cucumber/cucumber-ruby-core
236
- [cucumber-rails]: https://github.com/cucumber/cucumber-rails
237
- [cucumber-ruby-issues]: https://github.com/cucumber/cucumber-ruby/search?q=is%3Aissue
238
- [cucumber/common-issues]: https://github.com/cucumber/common/search?q=is%3Aissue
239
- [cucumber-issues]: https://github.com/search?q=is%3Aissue+user%3Acucumber
240
- [how-to-create-a-draft-pr]: https://docs.github.com/github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests#draft-pull-requests
241
- [how-to-fork]: https://docs.github.com/github/collaborating-with-pull-requests/working-with-forks/about-forks
242
- [sign your commits]: https://docs.github.com/en/github/authenticating-to-github/managing-commit-signature-verification/signing-commits
243
- [minimal-reproducible-example]: https://stackoverflow.com/help/minimal-reproducible-example
244
- [RVM]: https://rvm.io/
245
- [rbenv]: https://github.com/rbenv/rbenv
246
- [Bundler]: https://bundler.io/
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'autotest'
4
- require 'autotest/cucumber_mixin'
5
-
6
- class Autotest::Cucumber < Autotest
7
- include CucumberMixin
8
- end
@@ -1,133 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'autotest'
4
- require 'tempfile'
5
- require 'cucumber'
6
- require 'cucumber/cli/profile_loader'
7
-
8
- module Autotest::CucumberMixin
9
- def self.included(receiver)
10
- receiver::ALL_HOOKS << %i[run_features ran_features]
11
- end
12
-
13
- attr_accessor :features_to_run
14
-
15
- def initialize
16
- super
17
- reset_features
18
- end
19
-
20
- def run
21
- hook :initialize
22
- reset
23
- reset_features
24
- add_sigint_handler
25
-
26
- loop do # ^c handler
27
- wait_for_green
28
- if tainted
29
- rerun_all_tests
30
- rerun_all_features if all_good
31
- else
32
- hook :all_good
33
- end
34
- wait_for_changes
35
- # Once tests and features are green, reset features every
36
- # time a file is changed to see if anything breaks.
37
- reset_features
38
- rescue Interrupt
39
- break if wants_to_quit
40
-
41
- reset
42
- reset_features
43
- end
44
- hook :quit
45
- end
46
-
47
- def all_features_good
48
- features_to_run == ''
49
- end
50
-
51
- def wait_for_green
52
- loop do
53
- super
54
- run_features
55
- wait_for_changes unless all_features_good
56
- break if all_features_good
57
- end
58
- end
59
-
60
- def rerun_all_features
61
- reset_features
62
- run_features
63
- end
64
-
65
- def reset_features
66
- self.features_to_run = :all
67
- end
68
-
69
- def run_features
70
- hook :run_features
71
- Tempfile.open('autotest-cucumber') do |dirty_features_file|
72
- cmd = make_cucumber_cmd(features_to_run, dirty_features_file.path)
73
- break if cmd.empty?
74
-
75
- old_sync = $stdout.sync
76
- $stdout.sync = true
77
- self.results = []
78
- line = []
79
- begin
80
- open("| #{cmd}", 'r') do |f| # rubocop:disable Security/Open
81
- until f.eof?
82
- c = f.getc || break
83
- print(c)
84
- line << c
85
- next unless c == "\n"
86
-
87
- results << line.join
88
- line.clear
89
- end
90
- end
91
- ensure
92
- $stdout.sync = old_sync
93
- end
94
- self.features_to_run = dirty_features_file.read.strip
95
- self.tainted = true unless features_to_run == ''
96
- end
97
- hook :ran_features
98
- end
99
-
100
- def make_cucumber_cmd(features_to_run, _dirty_features_filename)
101
- return '' if features_to_run.empty?
102
-
103
- profile_loader = Cucumber::Cli::ProfileLoader.new
104
-
105
- profile = profile(profile_loader)
106
-
107
- args = created_args(features_to_run, profile)
108
-
109
- "#{Cucumber::RUBY_BINARY} #{Cucumber::BINARY} #{args}"
110
- end
111
-
112
- def profile(profile_loader)
113
- profile ||= 'autotest-all' if profile_loader.profile?('autotest-all') && features_to_run == :all
114
- profile ||= 'autotest' if profile_loader.profile?('autotest')
115
- profile || nil
116
- end
117
-
118
- def created_args(features_to_run, profile)
119
- args = if profile
120
- ['--profile', profile]
121
- else
122
- %w[--format] << (features_to_run == :all ? 'progress' : 'pretty')
123
- end
124
- # No --color option as some IDEs (Netbeans) don't output them very well (1 failed step)
125
- args += %w[--format rerun --out] << dirty_features_filename
126
- args << (features_to_run == :all ? '' : features_to_run)
127
-
128
- # All steps becom undefined during rerun unless the following is run.
129
- args << 'features/step_definitions' << 'features/support' unless features_to_run == :all
130
-
131
- args.join(' ')
132
- end
133
- end
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'autotest/rails'
4
- require 'autotest/cucumber_mixin'
5
-
6
- class Autotest::CucumberRails < Autotest::Rails
7
- include CucumberMixin
8
- end
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'autotest/cucumber_mixin'
4
- require 'autotest/rails_rspec'
5
-
6
- class Autotest::CucumberRailsRspec < Autotest::RailsRspec
7
- include CucumberMixin
8
- end
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'autotest/cucumber_mixin'
4
- require 'autotest/rails_rspec2'
5
-
6
- class Autotest::CucumberRailsRspec2 < Autotest::RailsRspec2
7
- include CucumberMixin
8
- end
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'autotest/cucumber_mixin'
4
- require 'autotest/rspec'
5
-
6
- class Autotest::CucumberRspec < Autotest::Rspec
7
- include CucumberMixin
8
- end
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'autotest/cucumber_mixin'
4
- require 'autotest/rspec2'
5
-
6
- class Autotest::CucumberRspec2 < Autotest::Rspec2
7
- include CucumberMixin
8
- end
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- Autotest.add_discovery do
4
- if File.directory?('features')
5
- case ENV['AUTOFEATURE']
6
- when /true/i
7
- 'cucumber'
8
- when /false/i
9
- # noop
10
- else
11
- puts '(Not running features. To run features in autotest, set AUTOFEATURE=true.)'
12
- end
13
- end
14
- end
data/lib/cucumber/version DELETED
@@ -1 +0,0 @@
1
- 8.0.0