cucumber 4.0.0.rc.6 → 5.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cf81b80049480e75914eab234ad671608f10a474e8850ecbda9e3cdca96f9e4e
4
- data.tar.gz: 4a692380408f3bd93ff079e192391bc921967ce96bf090f7cf010269c806a6a5
3
+ metadata.gz: ef0451fffdd6dc7d18e7b75d248e3e75dee4f15bb328b8c313e4b6a5606741eb
4
+ data.tar.gz: 9c14ead4ef9845dc3762d8ffb2d53e9d83c0ad6f66898a104ccd602f207a273b
5
5
  SHA512:
6
- metadata.gz: 3b1a3f2fcb5db9237bef23b510cadf0286ea61b19adab4fbcc67f4df14ded7adf2c33d2e4165f45be7361dce6fb418f74deadf3e0e1a7d4e8f2ba23c0e8a6c62
7
- data.tar.gz: 79d699ae305489e034fb16edf31d36304c2a0fb486bff4003f8e24abd786d81510eab5fdca6d32ca3348ce24b634cc6954d800b03494e3ef1dbba57ab7b9cc78
6
+ metadata.gz: fd5f761cb29cd344974869cb82a4c25f2f648e11418296c3e7fb8a8d91a9934459519c26bdb89ce37ccccfe789965111e513c92a8106c5eccc81eec6b12a9288
7
+ data.tar.gz: 4adff7878c3433ba0cf48a7a15b0e5b1f007ab22b8cc001c5c751c87d0328c9c86124ac3e3e7c7ea2b793052f021feb8be90bbd2a3d6491413e12080ddf5ba64
@@ -9,6 +9,105 @@ This document is formatted according to the principles of [Keep A CHANGELOG](htt
9
9
  Please visit [cucumber/CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CONTRIBUTING.md) for more info on how to contribute to Cucumber.
10
10
 
11
11
  ----
12
+
13
+ ## [In GIT](https://github.com/cucumber/cucumber-ruby/compare/v5.1.0...master)
14
+
15
+ ### Added
16
+
17
+ ### Changed
18
+
19
+ ### Removed
20
+
21
+ ### Deprecated
22
+
23
+ ### Fixed
24
+
25
+ ## [5.1.0](https://github.com/cucumber/cucumber-ruby/compare/v5.0.0...5.1.0)
26
+
27
+ ### Added
28
+
29
+ * `-X GET` in an `--out` URL will now issue a `GET` request *without* a body. If the response is `202 Accepted` *and*
30
+ the `Location` header is present, a new `PUT` request will be sent *with* the body.
31
+
32
+ The main reason for this added behaviour is to allow request bodies larger than 6Mb to be sent while using `--publish`.
33
+ This also improves performance since the request body is only sent once (previously it would be sent twice).
34
+
35
+ ### Changed
36
+
37
+ * Set banner border color to green when publishing reports
38
+ * Postpone removal of `--format=json`, `embed` and `puts` to version 6.0.0 in deprecation messages
39
+
40
+ ### Fixed
41
+
42
+ * Display banner on stderr when publishing reports [#1462](https://github.com/cucumber/cucumber-ruby/issues/1462)
43
+
44
+ ## [5.0.0](https://github.com/cucumber/cucumber-ruby/compare/v4.1.0...5.0.0)
45
+
46
+ ### Added
47
+
48
+ * `--publish` automatically publishes reports to [reports.cucumber.io](https://reports.cucumber.io)
49
+ * `--publish-quiet` does not print information banner about [reports.cucumber.io](https://reports.cucumber.io)
50
+
51
+ ### Changed
52
+
53
+ * `-q, --quiet` will also imply `--publish-quiet` in addition to `--no-snippets --no-source --no-duration`
54
+
55
+ ### Removed
56
+
57
+ * Dropped support for Ruby [2.3](https://www.ruby-lang.org/en/news/2019/03/31/support-of-ruby-2-3-has-ended/)
58
+ and [2.4](https://www.ruby-lang.org/en/news/2020/04/05/support-of-ruby-2-4-has-ended/)
59
+
60
+ ### Fixed
61
+
62
+ * Update code to be compatible with `diff-lcs` versions 1.3 and 1.4
63
+ * Defer registration of `at_exit` hook that flushes and closes formatter streams
64
+ ([#1458](https://github.com/cucumber/cucumber-ruby/pull/1458))
65
+ * Updated gems (see git diff for details)
66
+ * `cucumber-expressions`
67
+ * `cucumber-gherkin`
68
+ * `cucumber-create-meta`
69
+ * `cucumber-messages`
70
+ * Fix issue with timestamp nanos [#1438](https://github.com/cucumber/cucumber-ruby/issues/1438)
71
+ * `cucumber-html-formatter`
72
+ * Add filtering capabilities [#1444](https://github.com/cucumber/cucumber-ruby/issues/1444)
73
+ * Fix Interceptor that was raising exception when calling `puts` on the wrapped stream ([#1445](https://github.com/cucumber/cucumber-ruby/issues/1445))
74
+
75
+ ## [4.1.0](https://github.com/cucumber/cucumber-ruby/compare/v4.0.1...v4.1.0)
76
+
77
+ ### Changed
78
+
79
+ * Use [`cucumber-create-meta`](https://rubygems.org/gems/cucumber-create-meta) to produce the `Meta` message before the run.
80
+
81
+ * Updated gems:
82
+ * `cucumber-wire` ~> 3.1.0
83
+ * `cucumber-core` ~> 7.1.0
84
+ * `cucumber-gherkin` ~> 14.0.1
85
+ * Fix issue with empty feature files [#1427](https://github.com/cucumber/cucumber-ruby/issues/1427)
86
+ * `cucumber-messages` ~> 12.2.0
87
+ * `cucumber-html-formatter` ~> 7.0.0
88
+ * Fix issue with Hook attachments [#1420](https://github.com/cucumber/cucumber-ruby/issues/1420)
89
+
90
+ ### Fixed
91
+
92
+ * `AfterStep` hook do not cause issue when running `message` formatter. [#1433](https://github.com/cucumber/cucumber-ruby/issues/1433) - [#1434](https://github.com/cucumber/cucumber-ruby/pull/1434)
93
+
94
+
95
+ ## [4.0.1](https://github.com/cucumber/cucumber-ruby/compare/v4.0.0...v4.0.1)
96
+
97
+ ### Fixed
98
+
99
+ * force reference to `diff-lcs` to 1.3 as 1.4 introduced breaking changes.
100
+
101
+ ## [4.0.0](https://github.com/cucumber/cucumber-ruby/compare/v4.0.0.rc.5...v4.0.0)
102
+
103
+ ### Changed
104
+
105
+ * `log` method can now be called with non-string objects and will run `.to_s` on them. [#1410](https://github.com/cucumber/cucumber-ruby/issues/1410)
106
+
107
+ ### Improved
108
+
109
+ * Display snippet when using undefined parameter type [#1411](https://github.com/cucumber/cucumber-ruby/issues/1411)
110
+
12
111
  ## [4.0.0.rc.6](https://github.com/cucumber/cucumber-ruby/compare/v4.0.0.rc.5...4.0.0.rc.6)
13
112
 
14
113
  ### Changed
@@ -80,7 +179,7 @@ Please visit [cucumber/CONTRIBUTING.md](https://github.com/cucumber/cucumber/blo
80
179
  * If you wish to alter this, then you can set a top level config option: `Cucumber.use_legacy_autoloader`
81
180
  * Like most config options, setting this inside a `spec_helper.rb` or `env.rb` file is advised
82
181
  * For more information on this change, including why it was made. Please read this
83
- [Blog Post](www.google.com)
182
+ [Blog Post](https://cucumber.io/blog/open-source/tweaking-cucumber-rubys-auto-loader/)
84
183
  ([#1349](https://github.com/cucumber/cucumber-ruby/pull/1349),
85
184
  [#1043](https://github.com/cucumber/cucumber-ruby/issues/1043)
86
185
  [luke-hill](https://github.com/luke-hill))
@@ -59,13 +59,13 @@ help us to correct style violations reported here:
59
59
 
60
60
  ## Release Process
61
61
 
62
- * Bump the version number in `lib/cucumber/version`.
63
- * Make sure `CHANGELOG.md` is updated with the upcoming version number, and has entries for all fixes.
64
-
65
- Now release it
66
-
67
- bundle update
68
- bundle exec rake
69
- git commit -m "Release X.Y.Z"
70
- # Make sure you run gem signin as the cukebot@cucumber.io user before running the following step. Credentials can be found in 1Password
71
- rake release
62
+ * Upgrade gems with `scripts/update-gemspec`
63
+ * Bump the version number in `lib/cucumber/version`
64
+ * Update `CHANGELOG.md` with the upcoming version number and create a new `In Git` section
65
+ * Remove empty sections from `CHANGELOG.md`
66
+ * Now release it:
67
+
68
+ ```
69
+ git commit -am "Release X.Y.Z"
70
+ make release
71
+ ```
@@ -24,23 +24,21 @@ module Autotest::CucumberMixin
24
24
  add_sigint_handler
25
25
 
26
26
  loop do # ^c handler
27
- begin
28
- get_to_green
29
- if tainted
30
- rerun_all_tests
31
- rerun_all_features if all_good
32
- else
33
- hook :all_good
34
- end
35
- wait_for_changes
36
- # Once tests and features are green, reset features every
37
- # time a file is changed to see if anything breaks.
38
- reset_features
39
- rescue Interrupt
40
- break if wants_to_quit
41
- reset
42
- reset_features
27
+ get_to_green
28
+ if tainted
29
+ rerun_all_tests
30
+ rerun_all_features if all_good
31
+ else
32
+ hook :all_good
43
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
+ reset
41
+ reset_features
44
42
  end
45
43
  hook :quit
46
44
  end
@@ -9,6 +9,7 @@ require 'cucumber/core/test/result'
9
9
  module Cucumber
10
10
  module Cli
11
11
  class Options
12
+ CUCUMBER_PUBLISH_URL = ENV['CUCUMBER_PUBLISH_URL'] || 'https://messages.cucumber.io/api/reports -X GET'
12
13
  INDENT = ' ' * 53
13
14
  BUILTIN_FORMATS = {
14
15
  'pretty' => ['Cucumber::Formatter::Pretty', 'Prints the feature as is - in colours.'],
@@ -93,6 +94,10 @@ module Cucumber
93
94
 
94
95
  @args.options do |opts| # rubocop:disable Metrics/BlockLength
95
96
  opts.banner = banner
97
+ opts.on('--publish', 'Publish a report to https://reports.cucumber.io') do
98
+ set_option :publish_enabled, true
99
+ end
100
+ opts.on('--publish-quiet', 'Don\'t print information banner about publishing reports') { set_option :publish_quiet }
96
101
  opts.on('-r LIBRARY|DIR', '--require LIBRARY|DIR', *require_files_msg) { |lib| require_files(lib) }
97
102
 
98
103
  opts.on('-j DIR', '--jars DIR', 'Load all the jars under DIR') { |jars| load_jars(jars) } if Cucumber::JRUBY
@@ -117,7 +122,7 @@ module Cucumber
117
122
  opts.on('-s', '--no-source', "Don't print the file and line of the step definition with the steps.") { set_option :source, false }
118
123
  opts.on('-i', '--no-snippets', "Don't print snippets for pending steps.") { set_option :snippets, false }
119
124
  opts.on('-I', '--snippet-type TYPE', *snippet_type_msg) { |v| set_option :snippet_type, v.to_sym }
120
- opts.on('-q', '--quiet', 'Alias for --no-snippets --no-source.') { shut_up }
125
+ opts.on('-q', '--quiet', 'Alias for --no-snippets --no-source --no-duration --publish-quiet.') { shut_up }
121
126
  opts.on('--no-duration', "Don't print the duration at the end of the summary") { set_option :duration, false }
122
127
  opts.on('-b', '--backtrace', 'Show full backtrace for all errors.') { Cucumber.use_full_backtrace = true }
123
128
  opts.on('-S', '--[no-]strict', *strict_msg) { |setting| set_strict(setting) }
@@ -145,6 +150,8 @@ Specify SEED to reproduce the shuffling from a previous run.
145
150
  opts.on_tail('-h', '--help', "You're looking at it.") { exit_ok(opts.help) }
146
151
  end.parse!
147
152
 
153
+ process_publish_options
154
+
148
155
  @args.map! { |a| "#{a}:#{@options[:lines]}" } if @options[:lines]
149
156
 
150
157
  extract_environment_variables
@@ -182,6 +189,18 @@ Specify SEED to reproduce the shuffling from a previous run.
182
189
 
183
190
  private
184
191
 
192
+ def process_publish_options
193
+ @options[:publish_enabled] = true if truthy_string?(ENV['CUCUMBER_PUBLISH_ENABLED']) || ENV['CUCUMBER_PUBLISH_TOKEN']
194
+ @options[:formats] << publisher if @options[:publish_enabled]
195
+
196
+ @options[:publish_quiet] = true if truthy_string?(ENV['CUCUMBER_PUBLISH_QUIET'])
197
+ end
198
+
199
+ def truthy_string?(str)
200
+ return false if str.nil?
201
+ str !~ /^(false|no|0)$/i
202
+ end
203
+
185
204
  def color_msg
186
205
  [
187
206
  'Whether or not to use ANSI color in the output. Cucumber decides',
@@ -302,9 +321,8 @@ Specify SEED to reproduce the shuffling from a previous run.
302
321
  "formatter's docs to see whether to pass a file, dir or URL.",
303
322
  "\n",
304
323
  'When using a URL, the output of the formatter will be sent as the HTTP request body.',
305
- 'HTTP headers and request method can be set with http- prefixed query parameters,',
306
- 'for example ?http-content-type=application/json&http-method=PUT.',
307
- 'All http- prefixed query parameters will be removed from the sent query parameters.'
324
+ 'HTTP headers and request method can be set with cURL like options.',
325
+ 'Example: --out "http://example.com -X POST -H Content-Type:text/json"'
308
326
  ]
309
327
  end
310
328
 
@@ -349,7 +367,13 @@ Specify SEED to reproduce the shuffling from a previous run.
349
367
  end
350
368
 
351
369
  def require_jars(jars)
352
- Dir["#{jars}/**/*.jar"].each { |jar| require jar }
370
+ Dir["#{jars}/**/*.jar"].sort.each { |jar| require jar }
371
+ end
372
+
373
+ def publisher
374
+ url = CUCUMBER_PUBLISH_URL
375
+ url += %( -H "Authorization: Bearer #{ENV['CUCUMBER_PUBLISH_TOKEN']}") if ENV['CUCUMBER_PUBLISH_TOKEN']
376
+ ['message', {}, url]
353
377
  end
354
378
 
355
379
  def language(lang)
@@ -416,6 +440,7 @@ Specify SEED to reproduce the shuffling from a previous run.
416
440
  end
417
441
 
418
442
  def shut_up
443
+ @options[:publish_quiet] = true
419
444
  @options[:snippets] = false
420
445
  @options[:source] = false
421
446
  @options[:duration] = false
@@ -62,6 +62,14 @@ module Cucumber
62
62
  @options[:dry_run]
63
63
  end
64
64
 
65
+ def publish_enabled?
66
+ @options[:publish_enabled]
67
+ end
68
+
69
+ def publish_quiet?
70
+ @options[:publish_quiet]
71
+ end
72
+
65
73
  def fail_fast?
66
74
  @options[:fail_fast]
67
75
  end
@@ -197,14 +205,12 @@ module Cucumber
197
205
 
198
206
  def formatter_factories
199
207
  formats.map do |format, formatter_options, path_or_io|
200
- begin
201
- factory = formatter_class(format)
202
- yield factory,
203
- formatter_options,
204
- path_or_io
205
- rescue Exception => e # rubocop:disable Lint/RescueException
206
- raise e, "#{e.message}\nError creating formatter: #{format}", e.backtrace
207
- end
208
+ factory = formatter_class(format)
209
+ yield factory,
210
+ formatter_options,
211
+ path_or_io
212
+ rescue Exception => e # rubocop:disable Lint/RescueException
213
+ raise e, "#{e.message}\nError creating formatter: #{format}", e.backtrace
208
214
  end
209
215
  end
210
216
 
@@ -256,6 +262,7 @@ module Cucumber
256
262
  strict: Cucumber::Core::Test::Result::StrictConfiguration.new,
257
263
  require: [],
258
264
  dry_run: false,
265
+ publish_quiet: false,
259
266
  fail_fast: false,
260
267
  formats: [],
261
268
  excludes: [],
@@ -41,7 +41,7 @@ module Cucumber
41
41
 
42
42
  module ForDevelopers
43
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
44
+ raise "This method is due for removal after version #{remove_after_version}" if Cucumber::VERSION >= remove_after_version
45
45
  end
46
46
  end
47
47
 
@@ -11,7 +11,7 @@ module Cucumber
11
11
  begin
12
12
  raise new(with_prefix(step_name)) # rubocop:disable Style/RaiseArgs
13
13
  rescue StandardError => e
14
- return e
14
+ e
15
15
  end
16
16
  end
17
17
 
@@ -49,7 +49,4 @@ module Cucumber
49
49
  super(messages.join("\n"))
50
50
  end
51
51
  end
52
-
53
- class LogTypeInvalid < StandardError
54
- end
55
52
  end
@@ -38,7 +38,8 @@ module Cucumber
38
38
  TestStepCreated,
39
39
  TestStepFinished,
40
40
  TestStepStarted,
41
- Envelope
41
+ Envelope,
42
+ UndefinedParameterType
42
43
  )
43
44
  end
44
45
  end
@@ -0,0 +1,10 @@
1
+ require 'cucumber/core/events'
2
+
3
+ module Cucumber
4
+ module Events
5
+ class UndefinedParameterType < Core::Event.new(:type_name, :expression)
6
+ attr_reader :type_name
7
+ attr_reader :expression
8
+ end
9
+ end
10
+ end
@@ -136,7 +136,6 @@ module Cucumber
136
136
 
137
137
  private
138
138
 
139
- # rubocop:disable Metrics/PerceivedComplexity
140
139
  def process_scenario_container(container, original_previous_node)
141
140
  container.children.each do |child|
142
141
  previous_node = original_previous_node
@@ -158,7 +157,6 @@ module Cucumber
158
157
  end
159
158
  end
160
159
  end
161
- # rubocop:enable Metrics/PerceivedComplexity
162
160
  end
163
161
  end
164
162
  end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # rubocop:disable Metrics/ModuleLength
4
+
3
5
  require 'cucumber/formatter/ansicolor'
4
6
  require 'cucumber/formatter/duration'
5
7
  require 'cucumber/gherkin/i18n'
@@ -116,14 +118,21 @@ module Cucumber
116
118
  @snippets_input << Console::SnippetData.new(keyword, test_step)
117
119
  end
118
120
 
121
+ def collect_undefined_parameter_type_names(undefined_parameter_type)
122
+ @undefined_parameter_types << undefined_parameter_type.type_name
123
+ end
124
+
119
125
  def print_snippets(options)
120
126
  return unless options[:snippets]
121
- return if @snippets_input.empty?
122
127
 
123
128
  snippet_text_proc = lambda do |step_keyword, step_name, multiline_arg|
124
129
  snippet_text(step_keyword, step_name, multiline_arg)
125
130
  end
126
- do_print_snippets(snippet_text_proc)
131
+ do_print_snippets(snippet_text_proc) unless @snippets_input.empty?
132
+
133
+ @undefined_parameter_types.map do |type_name|
134
+ do_print_undefined_parameter_type_snippet(type_name)
135
+ end
127
136
  end
128
137
 
129
138
  def do_print_snippets(snippet_text_proc)
@@ -181,6 +190,24 @@ module Cucumber
181
190
  @io.puts "Using the #{profiles_sentence} profile#{'s' if profiles.size > 1}..."
182
191
  end
183
192
 
193
+ def do_print_undefined_parameter_type_snippet(type_name)
194
+ camelized = type_name.split(/_|-/).collect(&:capitalize).join
195
+
196
+ @io.puts [
197
+ "The parameter #{type_name} is not defined. You can define a new one with:",
198
+ '',
199
+ 'ParameterType(',
200
+ " name: '#{type_name}',",
201
+ ' regexp: /some regexp here/,',
202
+ " type: #{camelized},",
203
+ ' # The transformer takes as many arguments as there are capture groups in the regexp,',
204
+ ' # or just one if there are none.',
205
+ " transformer: ->(s) { #{camelized}.new(s) }",
206
+ ')',
207
+ ''
208
+ ].join("\n")
209
+ end
210
+
184
211
  private
185
212
 
186
213
  FORMATS = Hash.new { |hash, format| hash[format] = method(format).to_proc }
@@ -219,3 +246,4 @@ module Cucumber
219
246
  end
220
247
  end
221
248
  end
249
+ # rubocop:enable Metrics/ModuleLength