cucumber 5.1.0 → 5.3.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: ef0451fffdd6dc7d18e7b75d248e3e75dee4f15bb328b8c313e4b6a5606741eb
4
- data.tar.gz: 9c14ead4ef9845dc3762d8ffb2d53e9d83c0ad6f66898a104ccd602f207a273b
3
+ metadata.gz: 61cd1181584bcc92134ced753b975cfd74a8501c00bdce0c75695145cf4ceaef
4
+ data.tar.gz: 57f3dec452665986e5f4916ad78f453e833a9fc94ba2f45124a5643f87b77d0f
5
5
  SHA512:
6
- metadata.gz: fd5f761cb29cd344974869cb82a4c25f2f648e11418296c3e7fb8a8d91a9934459519c26bdb89ce37ccccfe789965111e513c92a8106c5eccc81eec6b12a9288
7
- data.tar.gz: 4adff7878c3433ba0cf48a7a15b0e5b1f007ab22b8cc001c5c751c87d0328c9c86124ac3e3e7c7ea2b793052f021feb8be90bbd2a3d6491413e12080ddf5ba64
6
+ metadata.gz: f5f971b543114f4baab695a987ed131fe39931a7b644871ce036862a310b9bf17f52f9d4fe80069072864a295d9c31e3254be5f363e87a946ff80733bf33ecb7
7
+ data.tar.gz: 1c3bb21ce293544c88161cd40460be9e4b12c0dcc3221e50e976a8cc6d5666a982ebde2f5a7bb33d3de65d1423f80d14eaab1b6570a6c03434b568c6cde6e09d
@@ -10,18 +10,60 @@ Please visit [cucumber/CONTRIBUTING.md](https://github.com/cucumber/cucumber/blo
10
10
 
11
11
  ----
12
12
 
13
- ## [In GIT](https://github.com/cucumber/cucumber-ruby/compare/v5.1.0...master)
13
+ ## [In GIT](https://github.com/cucumber/cucumber-ruby/compare/v5.3.0...master)
14
14
 
15
15
  ### Added
16
16
 
17
+ ### Fixed
18
+
17
19
  ### Changed
18
20
 
19
21
  ### Removed
20
22
 
21
- ### Deprecated
23
+ ### Security fixes
24
+
25
+ ## [5.3.0](https://github.com/cucumber/cucumber-ruby/compare/v5.2.0...v5.3.0)
26
+
27
+ ### Added
28
+
29
+ * `fileattribute` cli argument available to attach `file` to junit formatter
30
+
31
+ ### Fixed
32
+
33
+ * Circle-CI windows build now silently installs MSYS2 using Chocolatey before
34
+ setting-up the ruby devkit with ridk
35
+ ([#1503](https://github.com/cucumber/cucumber-ruby/pull/1503)
36
+ [aurelien-reeves](https://github.com/aurelien-reeves))
37
+
38
+ * `--publish` and no formatter now uses the pretty formatter per default
39
+ ([#1468](https://github.com/cucumber/cucumber-ruby/issues/1468)
40
+ [#1500](https://github.com/cucumber/cucumber-ruby/pull/1500)
41
+ [aurelien-reeves](https://github.com/aurelien-reeves))
42
+
43
+ ## [5.2.0](https://github.com/cucumber/cucumber-ruby/compare/v5.1.3...v5.2.0)
44
+
45
+ ### Changed
46
+
47
+ * `--publish` uses the response provided by the server as the banner [#1472](https://github.com/cucumber/cucumber-ruby/issues/1472)
48
+
49
+ ## [5.1.3](https://github.com/cucumber/cucumber-ruby/compare/v5.1.2...v5.1.3)
50
+
51
+ ### Fixed
52
+
53
+ * The `CUCUMBER_PUBLISH_TOKEN` now sets the correct HTTP header, following a fix in the curl option parser.
54
+
55
+ ## [5.1.2](https://github.com/cucumber/cucumber-ruby/compare/v5.1.1...v5.1.2)
22
56
 
23
57
  ### Fixed
24
58
 
59
+ * Do not send headers after following redirection [#1475](https://github.com/cucumber/cucumber-ruby/pull/1475)
60
+
61
+ ## [5.1.1](https://github.com/cucumber/cucumber-ruby/compare/v5.1.0...v5.1.1)
62
+
63
+ ### Security fixes
64
+
65
+ * Update `cucumber-create-meta` to 2.0.2
66
+
25
67
  ## [5.1.0](https://github.com/cucumber/cucumber-ruby/compare/v5.0.0...5.1.0)
26
68
 
27
69
  ### Added
@@ -65,7 +65,9 @@ help us to correct style violations reported here:
65
65
  * Remove empty sections from `CHANGELOG.md`
66
66
  * Now release it:
67
67
 
68
- ```
69
- git commit -am "Release X.Y.Z"
70
- make release
71
- ```
68
+ ```
69
+ git commit -am "Release X.Y.Z"
70
+ make release
71
+ ```
72
+
73
+ * Finally, update the cucumber-ruby version in the [documentation project](https://cucumber.io/docs/installation/) in [versions.yaml](https://github.com/cucumber/docs.cucumber.io/blob/master/data/versions.yaml) file.
@@ -126,13 +126,35 @@ module Cucumber
126
126
  end
127
127
 
128
128
  def arrange_formats
129
- @options[:formats] << ['pretty', {}, @out_stream] if @options[:formats].empty?
129
+ add_default_formatter if needs_default_formatter?
130
+
130
131
  @options[:formats] = @options[:formats].sort_by do |f|
131
132
  f[2] == @out_stream ? -1 : 1
132
133
  end
133
134
  @options[:formats].uniq!
134
135
  @options.check_formatter_stream_conflicts
135
136
  end
137
+
138
+ def add_default_formatter
139
+ @options[:formats] << ['pretty', {}, @out_stream]
140
+ end
141
+
142
+ def needs_default_formatter?
143
+ formatter_missing? || publish_only?
144
+ end
145
+
146
+ def formatter_missing?
147
+ @options[:formats].empty?
148
+ end
149
+
150
+ def publish_only?
151
+ @options[:formats]
152
+ .uniq
153
+ .map { |formatter, _, stream| [formatter, stream] }
154
+ .uniq
155
+ .reject { |formatter, stream| formatter == 'message' && stream != @out_stream }
156
+ .empty?
157
+ end
136
158
  end
137
159
  end
138
160
  end
@@ -22,7 +22,8 @@ module Cucumber
22
22
  "#{INDENT}filename instead."],
23
23
  'stepdefs' => ['Cucumber::Formatter::Stepdefs', "Prints All step definitions with their locations. Same as\n" \
24
24
  "#{INDENT}the usage formatter, except that steps are not printed."],
25
- 'junit' => ['Cucumber::Formatter::Junit', 'Generates a report similar to Ant+JUnit.'],
25
+ 'junit' => ['Cucumber::Formatter::Junit', "Generates a report similar to Ant+JUnit. Use\n" \
26
+ "#{INDENT}junit,fileattribute=true to include a file attribute."],
26
27
  'json' => ['Cucumber::Formatter::Json', '[DEPRECATED] Prints the feature as JSON'],
27
28
  'message' => ['Cucumber::Formatter::Message', 'Outputs protobuf messages'],
28
29
  'html' => ['Cucumber::Formatter::HTML', 'Outputs HTML report'],
@@ -335,7 +336,7 @@ Specify SEED to reproduce the shuffling from a previous run.
335
336
  'option is specified; all loading becomes explicit.',
336
337
  'Files in directories named "support" are still always',
337
338
  'loaded first when their parent directories are',
338
- 'required or if the "support" directoires themselves are',
339
+ 'required or if the "support" directories themselves are',
339
340
  'explicitly required.',
340
341
  'This option can be specified multiple times.'
341
342
  ]
@@ -8,7 +8,7 @@ module Cucumber
8
8
  include Io
9
9
 
10
10
  def initialize(config)
11
- @io = ensure_io(config.out_stream)
11
+ @io = ensure_io(config.out_stream, config.error_stream)
12
12
  @html_formatter = Cucumber::HTMLFormatter::Formatter.new(@io)
13
13
  @html_formatter.write_pre_message
14
14
 
@@ -1,5 +1,6 @@
1
1
  require 'net/http'
2
2
  require 'tempfile'
3
+ require 'shellwords'
3
4
 
4
5
  module Cucumber
5
6
  module Formatter
@@ -18,48 +19,43 @@ module Cucumber
18
19
 
19
20
  class CurlOptionParser
20
21
  def self.parse(options)
21
- chunks = options.split(/\s/).compact
22
- http_method = 'PUT'
23
- url = chunks[0]
24
- headers = ''
25
-
26
- last_flag = nil
27
- chunks.each do |chunk|
28
- if ['-X', '--request'].include?(chunk)
29
- last_flag = '-X'
30
- next
31
- end
32
-
33
- if chunk == '-H'
34
- last_flag = '-H'
35
- next
36
- end
22
+ args = Shellwords.split(options)
37
23
 
38
- if last_flag == '-X'
39
- http_method = chunk
40
- last_flag = nil
24
+ url = nil
25
+ http_method = 'PUT'
26
+ headers = {}
27
+
28
+ until args.empty?
29
+ arg = args.shift
30
+ case arg
31
+ when '-X', '--request'
32
+ http_method = remove_arg_for(args, arg)
33
+ when '-H'
34
+ header_arg = remove_arg_for(args, arg)
35
+ headers = headers.merge(parse_header(header_arg))
36
+ else
37
+ raise StandardError, "#{options} was not a valid curl command. Can't set url to #{arg} it is already set to #{url}" if url
38
+ url = arg
41
39
  end
42
-
43
- headers += chunk if last_flag == '-H'
44
40
  end
41
+ raise StandardError, "#{options} was not a valid curl command" unless url
45
42
 
46
43
  [
47
44
  url,
48
45
  http_method,
49
- make_headers(headers)
46
+ headers
50
47
  ]
51
48
  end
52
49
 
53
- def self.make_headers(headers)
54
- hash_headers = {}
55
- str_scanner = /("(?<key>[^":]+)\s*:\s*(?<value>[^":]+)")|('(?<key1>[^':]+)\s*:\s*(?<value1>[^':]+)')/
56
-
57
- headers.scan(str_scanner) do |header|
58
- header = header.compact!
59
- hash_headers[header[0]] = header[1]&.strip
60
- end
50
+ def self.remove_arg_for(args, arg)
51
+ return args.shift unless args.empty?
52
+ raise StandardError, "Missing argument for #{arg}"
53
+ end
61
54
 
62
- hash_headers
55
+ def self.parse_header(header_arg)
56
+ parts = header_arg.split(':', 2)
57
+ raise StandardError, "#{header_arg} was not a valid header" unless parts.length == 2
58
+ { parts[0].strip => parts[1].strip }
63
59
  end
64
60
  end
65
61
 
@@ -76,10 +72,11 @@ module Cucumber
76
72
  end
77
73
 
78
74
  def close
79
- resource_uri = send_content(@uri, @method, @headers)
80
-
81
- @reporter.report(resource_uri)
75
+ response = send_content(@uri, @method, @headers)
76
+ @reporter.report(response.body)
82
77
  @write_io.close
78
+ return if response.is_a?(Net::HTTPSuccess) || response.is_a?(Net::HTTPRedirection)
79
+ raise StandardError, "request to #{uri} failed with status #{response.code}"
83
80
  end
84
81
 
85
82
  def write(data)
@@ -121,16 +118,11 @@ module Cucumber
121
118
 
122
119
  case response
123
120
  when Net::HTTPAccepted
124
- return uri unless response['Location']
125
-
126
- send_content(URI(response['Location']), 'PUT', headers, attempt - 1)
127
- when Net::HTTPSuccess
128
- uri
121
+ send_content(URI(response['Location']), 'PUT', {}, attempt - 1) if response['Location']
129
122
  when Net::HTTPRedirection
130
123
  send_content(URI(response['Location']), method, headers, attempt - 1)
131
- else
132
- raise StandardError, "request to #{uri} failed with status #{response.code}"
133
124
  end
125
+ response
134
126
  end
135
127
 
136
128
  def build_request(uri, method, headers)
@@ -9,13 +9,13 @@ module Cucumber
9
9
  module Io
10
10
  module_function
11
11
 
12
- def ensure_io(path_or_url_or_io)
12
+ def ensure_io(path_or_url_or_io, error_stream)
13
13
  return nil if path_or_url_or_io.nil?
14
14
  return path_or_url_or_io if io?(path_or_url_or_io)
15
15
 
16
16
  io = if url?(path_or_url_or_io)
17
17
  url = path_or_url_or_io
18
- reporter = url.start_with?(Cucumber::Cli::Options::CUCUMBER_PUBLISH_URL) ? URLReporter.new($stderr) : NoReporter.new
18
+ reporter = url.start_with?(Cucumber::Cli::Options::CUCUMBER_PUBLISH_URL) ? URLReporter.new(error_stream) : NoReporter.new
19
19
  HTTPIO.open(url, nil, reporter)
20
20
  else
21
21
  File.open(path_or_url_or_io, Cucumber.file_mode('w'))
@@ -64,7 +64,7 @@ module Cucumber
64
64
  raise "You *must* specify --out FILE for the #{name} formatter" unless String == path.class
65
65
  raise "I can't write #{name} to a directory - it has to be a file" if File.directory?(path)
66
66
  raise "I can't write #{name} to a file in the non-existing directory #{File.dirname(path)}" unless File.directory?(File.dirname(path))
67
- ensure_io(path)
67
+ ensure_io(path, nil)
68
68
  end
69
69
 
70
70
  def ensure_dir(path, name)
@@ -22,7 +22,7 @@ module Cucumber
22
22
  '6.0.0'
23
23
  )
24
24
 
25
- @io = ensure_io(config.out_stream)
25
+ @io = ensure_io(config.out_stream, config.error_stream)
26
26
  @ast_lookup = AstLookup.new(config)
27
27
  @feature_hashes = []
28
28
  @step_or_hook_hash = {}
@@ -132,9 +132,12 @@ module Cucumber
132
132
  duration = ResultBuilder.new(result).test_case_duration
133
133
  @current_feature_data[:time] += duration
134
134
  classname = @current_feature_data[:feature].name
135
+ filename = @current_feature_data[:uri]
135
136
  name = scenario_designation
136
137
 
137
- @current_feature_data[:builder].testcase(classname: classname, name: name, time: format('%<duration>.6f', duration: duration)) do
138
+ testcase_attributes = get_testcase_attributes(classname, name, duration, filename)
139
+
140
+ @current_feature_data[:builder].testcase(testcase_attributes) do
138
141
  if !result.passed? && result.ok?(@config.strict)
139
142
  @current_feature_data[:builder].skipped
140
143
  @current_feature_data[:skipped] += 1
@@ -157,6 +160,20 @@ module Cucumber
157
160
  @current_feature_data[:tests] += 1
158
161
  end
159
162
 
163
+ def get_testcase_attributes(classname, name, duration, filename)
164
+ { classname: classname, name: name, time: format('%<duration>.6f', duration: duration) }.tap do |attributes|
165
+ attributes[:file] = filename if add_fileattribute?
166
+ end
167
+ end
168
+
169
+ def add_fileattribute?
170
+ return false if @config.formats.nil? || @config.formats.empty?
171
+
172
+ !!@config.formats.find do |format|
173
+ format.first == 'junit' && format.dig(1, 'fileattribute') == 'true'
174
+ end
175
+ end
176
+
160
177
  def get_backtrace_object(result)
161
178
  if result.failed?
162
179
  result.exception
@@ -10,7 +10,7 @@ module Cucumber
10
10
  include Io
11
11
 
12
12
  def initialize(config)
13
- @io = ensure_io(config.out_stream)
13
+ @io = ensure_io(config.out_stream, config.error_stream)
14
14
  super(config)
15
15
  end
16
16
 
@@ -32,7 +32,7 @@ module Cucumber
32
32
  private :in_scenario_outline, :print_background_steps
33
33
 
34
34
  def initialize(config)
35
- @io = ensure_io(config.out_stream)
35
+ @io = ensure_io(config.out_stream, config.error_stream)
36
36
  @config = config
37
37
  @options = config.to_hash
38
38
  @snippets_input = []
@@ -19,7 +19,7 @@ module Cucumber
19
19
 
20
20
  def initialize(config)
21
21
  @config = config
22
- @io = ensure_io(config.out_stream)
22
+ @io = ensure_io(config.out_stream, config.error_stream)
23
23
  @snippets_input = []
24
24
  @undefined_parameter_types = []
25
25
  @total_duration = 0
@@ -30,7 +30,9 @@ module Cucumber
30
30
  ],
31
31
  [
32
32
  'Environment variable: ',
33
- highlight('CUCUMBER_PUBLISH_ENABLED=true')
33
+ highlight('CUCUMBER_PUBLISH_ENABLED'),
34
+ '=',
35
+ highlight('true')
34
36
  ],
35
37
  [
36
38
  'cucumber.yml: ',
@@ -8,7 +8,7 @@ module Cucumber
8
8
  include Formatter::Io
9
9
 
10
10
  def initialize(config)
11
- @io = ensure_io(config.out_stream)
11
+ @io = ensure_io(config.out_stream, config.error_stream)
12
12
  @config = config
13
13
  @failures = {}
14
14
  config.on_event :test_case_finished do |event|
@@ -5,7 +5,7 @@ module Cucumber
5
5
  # The formatter used for <tt>--format steps</tt>
6
6
  class Steps
7
7
  def initialize(runtime, path_or_io, options)
8
- @io = ensure_io(path_or_io)
8
+ @io = ensure_io(path_or_io, nil)
9
9
  @options = options
10
10
  @step_definition_files = collect_steps(runtime)
11
11
  end
@@ -16,7 +16,7 @@ module Cucumber
16
16
 
17
17
  def initialize(config)
18
18
  @config = config
19
- @io = ensure_io(config.out_stream)
19
+ @io = ensure_io(config.out_stream, config.error_stream)
20
20
  @ast_lookup = AstLookup.new(config)
21
21
  @counts = ConsoleCounts.new(@config)
22
22
  @issues = ConsoleIssues.new(@config, @ast_lookup)
@@ -1,30 +1,17 @@
1
- require 'cucumber/term/banner'
2
-
3
1
  module Cucumber
4
2
  module Formatter
5
3
  class URLReporter
6
- include Term::Banner
7
-
8
4
  def initialize(io)
9
5
  @io = io
10
6
  end
11
7
 
12
- def report(url)
13
- uri = URI(url)
14
- display_banner(
15
- [
16
- 'View your Cucumber Report at:',
17
- [["https://reports.cucumber.io#{uri.path}", :cyan, :bold, :underline]],
18
- '',
19
- [['This report will self-destruct in 24h unless it is claimed or deleted.', :green, :bold]]
20
- ],
21
- @io
22
- )
8
+ def report(banner)
9
+ @io.puts(banner)
23
10
  end
24
11
  end
25
12
 
26
13
  class NoReporter
27
- def report(url); end
14
+ def report(banner); end
28
15
  end
29
16
  end
30
17
  end
@@ -137,4 +137,4 @@ module Cucumber
137
137
  end
138
138
 
139
139
  # TODO: can we avoid adding methods to the global namespace (Kernel)
140
- extend(Cucumber::Glue::Dsl) # rubocop:disable Style/MixinUsage
140
+ extend(Cucumber::Glue::Dsl)
@@ -1 +1 @@
1
- 5.1.0
1
+ 5.3.0
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cucumber
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.0
4
+ version: 5.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aslak Hellesøy
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-08-24 00:00:00.000000000 Z
13
+ date: 2021-01-28 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: builder
@@ -61,7 +61,7 @@ dependencies:
61
61
  version: '2.0'
62
62
  - - ">="
63
63
  - !ruby/object:Gem::Version
64
- version: 2.0.1
64
+ version: 2.0.2
65
65
  type: :runtime
66
66
  prerelease: false
67
67
  version_requirements: !ruby/object:Gem::Requirement
@@ -71,7 +71,7 @@ dependencies:
71
71
  version: '2.0'
72
72
  - - ">="
73
73
  - !ruby/object:Gem::Version
74
- version: 2.0.1
74
+ version: 2.0.2
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: cucumber-cucumber-expressions
77
77
  requirement: !ruby/object:Gem::Requirement
@@ -138,20 +138,20 @@ dependencies:
138
138
  requirements:
139
139
  - - "~>"
140
140
  - !ruby/object:Gem::Version
141
- version: '13.0'
141
+ version: '13.1'
142
142
  - - ">="
143
143
  - !ruby/object:Gem::Version
144
- version: 13.0.1
144
+ version: 13.1.0
145
145
  type: :runtime
146
146
  prerelease: false
147
147
  version_requirements: !ruby/object:Gem::Requirement
148
148
  requirements:
149
149
  - - "~>"
150
150
  - !ruby/object:Gem::Version
151
- version: '13.0'
151
+ version: '13.1'
152
152
  - - ">="
153
153
  - !ruby/object:Gem::Version
154
- version: 13.0.1
154
+ version: 13.1.0
155
155
  - !ruby/object:Gem::Dependency
156
156
  name: cucumber-wire
157
157
  requirement: !ruby/object:Gem::Requirement
@@ -381,7 +381,7 @@ dependencies:
381
381
  version: '1.6'
382
382
  - - ">="
383
383
  - !ruby/object:Gem::Version
384
- version: 1.6.0
384
+ version: 1.6.1
385
385
  type: :development
386
386
  prerelease: false
387
387
  version_requirements: !ruby/object:Gem::Requirement
@@ -391,27 +391,27 @@ dependencies:
391
391
  version: '1.6'
392
392
  - - ">="
393
393
  - !ruby/object:Gem::Version
394
- version: 1.6.0
394
+ version: 1.6.1
395
395
  - !ruby/object:Gem::Dependency
396
396
  name: octokit
397
397
  requirement: !ruby/object:Gem::Requirement
398
398
  requirements:
399
399
  - - "~>"
400
400
  - !ruby/object:Gem::Version
401
- version: '4.18'
401
+ version: '4.19'
402
402
  - - ">="
403
403
  - !ruby/object:Gem::Version
404
- version: 4.18.0
404
+ version: 4.19.0
405
405
  type: :development
406
406
  prerelease: false
407
407
  version_requirements: !ruby/object:Gem::Requirement
408
408
  requirements:
409
409
  - - "~>"
410
410
  - !ruby/object:Gem::Version
411
- version: '4.18'
411
+ version: '4.19'
412
412
  - - ">="
413
413
  - !ruby/object:Gem::Version
414
- version: 4.18.0
414
+ version: 4.19.0
415
415
  - !ruby/object:Gem::Dependency
416
416
  name: rack-test
417
417
  requirement: !ruby/object:Gem::Requirement
@@ -438,20 +438,20 @@ dependencies:
438
438
  requirements:
439
439
  - - "~>"
440
440
  - !ruby/object:Gem::Version
441
- version: '2.0'
441
+ version: '2.1'
442
442
  - - ">="
443
443
  - !ruby/object:Gem::Version
444
- version: 2.0.8.1
444
+ version: 2.1.0
445
445
  type: :development
446
446
  prerelease: false
447
447
  version_requirements: !ruby/object:Gem::Requirement
448
448
  requirements:
449
449
  - - "~>"
450
450
  - !ruby/object:Gem::Version
451
- version: '2.0'
451
+ version: '2.1'
452
452
  - - ">="
453
453
  - !ruby/object:Gem::Version
454
- version: 2.0.8.1
454
+ version: 2.1.0
455
455
  - !ruby/object:Gem::Dependency
456
456
  name: capybara
457
457
  requirement: !ruby/object:Gem::Requirement
@@ -642,5 +642,5 @@ requirements: []
642
642
  rubygems_version: 3.1.2
643
643
  signing_key:
644
644
  specification_version: 4
645
- summary: cucumber-5.1.0
645
+ summary: cucumber-5.3.0
646
646
  test_files: []