cucumber 4.0.0.rc.1 → 4.0.0.rc.6
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 +5 -5
- data/CHANGELOG.md +97 -4
- data/CONTRIBUTING.md +1 -18
- data/README.md +4 -5
- data/lib/autotest/cucumber_mixin.rb +2 -10
- data/lib/cucumber.rb +1 -1
- data/lib/cucumber/cli/configuration.rb +1 -1
- data/lib/cucumber/cli/main.rb +1 -0
- data/lib/cucumber/cli/options.rb +18 -13
- data/lib/cucumber/cli/profile_loader.rb +23 -12
- data/lib/cucumber/configuration.rb +11 -2
- data/lib/cucumber/deprecate.rb +29 -5
- data/lib/cucumber/errors.rb +5 -2
- data/lib/cucumber/events.rb +12 -7
- data/lib/cucumber/events/envelope.rb +9 -0
- data/lib/cucumber/events/hook_test_step_created.rb +13 -0
- data/lib/cucumber/events/test_case_created.rb +13 -0
- data/lib/cucumber/events/test_case_ready.rb +12 -0
- data/lib/cucumber/events/test_step_created.rb +13 -0
- data/lib/cucumber/filters.rb +1 -0
- data/lib/cucumber/filters/broadcast_test_case_ready_event.rb +12 -0
- data/lib/cucumber/formatter/ast_lookup.rb +43 -38
- data/lib/cucumber/formatter/backtrace_filter.rb +4 -1
- data/lib/cucumber/formatter/console.rb +4 -9
- data/lib/cucumber/formatter/console_issues.rb +1 -1
- data/lib/cucumber/formatter/duration.rb +1 -1
- data/lib/cucumber/formatter/duration_extractor.rb +2 -0
- data/lib/cucumber/formatter/errors.rb +6 -0
- data/lib/cucumber/formatter/html.rb +24 -0
- data/lib/cucumber/formatter/http_io.rb +146 -0
- data/lib/cucumber/formatter/interceptor.rb +3 -21
- data/lib/cucumber/formatter/io.rb +14 -8
- data/lib/cucumber/formatter/json.rb +46 -36
- data/lib/cucumber/formatter/junit.rb +13 -11
- data/lib/cucumber/formatter/message.rb +22 -0
- data/lib/cucumber/formatter/message_builder.rb +243 -0
- data/lib/cucumber/formatter/pretty.rb +65 -60
- data/lib/cucumber/formatter/query/hook_by_test_step.rb +31 -0
- data/lib/cucumber/formatter/query/pickle_by_test.rb +26 -0
- data/lib/cucumber/formatter/query/pickle_step_by_test_step.rb +26 -0
- data/lib/cucumber/formatter/query/step_definitions_by_test_step.rb +40 -0
- data/lib/cucumber/formatter/query/test_case_started_by_test_case.rb +40 -0
- data/lib/cucumber/formatter/summary.rb +1 -1
- data/lib/cucumber/formatter/usage.rb +3 -3
- data/lib/cucumber/gherkin/data_table_parser.rb +12 -3
- data/lib/cucumber/gherkin/steps_parser.rb +13 -3
- data/lib/cucumber/glue/hook.rb +18 -2
- data/lib/cucumber/glue/proto_world.rb +30 -18
- data/lib/cucumber/glue/registry_and_more.rb +40 -3
- data/lib/cucumber/glue/snippet.rb +2 -2
- data/lib/cucumber/glue/step_definition.rb +28 -4
- data/lib/cucumber/hooks.rb +8 -8
- data/lib/cucumber/multiline_argument.rb +1 -1
- data/lib/cucumber/multiline_argument/data_table.rb +17 -13
- data/lib/cucumber/platform.rb +1 -1
- data/lib/cucumber/rake/task.rb +3 -0
- data/lib/cucumber/runtime.rb +29 -3
- data/lib/cucumber/runtime/after_hooks.rb +6 -2
- data/lib/cucumber/runtime/before_hooks.rb +6 -2
- data/lib/cucumber/runtime/for_programming_languages.rb +1 -0
- data/lib/cucumber/runtime/step_hooks.rb +3 -2
- data/lib/cucumber/runtime/support_code.rb +3 -3
- data/lib/cucumber/runtime/user_interface.rb +2 -10
- data/lib/cucumber/step_definitions.rb +2 -2
- data/lib/cucumber/version +1 -1
- metadata +227 -73
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: cf81b80049480e75914eab234ad671608f10a474e8850ecbda9e3cdca96f9e4e
|
4
|
+
data.tar.gz: 4a692380408f3bd93ff079e192391bc921967ce96bf090f7cf010269c806a6a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b1a3f2fcb5db9237bef23b510cadf0286ea61b19adab4fbcc67f4df14ded7adf2c33d2e4165f45be7361dce6fb418f74deadf3e0e1a7d4e8f2ba23c0e8a6c62
|
7
|
+
data.tar.gz: 79d699ae305489e034fb16edf31d36304c2a0fb486bff4003f8e24abd786d81510eab5fdca6d32ca3348ce24b634cc6954d800b03494e3ef1dbba57ab7b9cc78
|
data/CHANGELOG.md
CHANGED
@@ -9,23 +9,115 @@ 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
|
+
## [4.0.0.rc.6](https://github.com/cucumber/cucumber-ruby/compare/v4.0.0.rc.5...4.0.0.rc.6)
|
12
13
|
|
13
|
-
|
14
|
+
### Changed
|
15
|
+
|
16
|
+
* Code snippet for an undefined step with a Doc String will ouput `doc_string` instead of `string` in block params
|
17
|
+
([#1401](https://github.com/cucumber/cucumber-ruby/issues/1401)
|
18
|
+
[#1402](https://github.com/cucumber/cucumber-ruby/pull/1402)
|
19
|
+
[karamosky](https://github.com/karamosky))
|
20
|
+
|
21
|
+
* Updated monorepo libraries:
|
22
|
+
- cucumber-gherkin ~> 13
|
23
|
+
- cucumber-html-formatter ~> 6
|
24
|
+
- cucumber-cucumber-expressions ~> 10
|
25
|
+
|
26
|
+
* Use `cucumber-ruby-core` 7.0.0
|
27
|
+
|
28
|
+
* Use `cucumber-ruby-wire` 3.0.0
|
29
|
+
|
30
|
+
* Use `body` field of attachments
|
31
|
+
|
32
|
+
### Improved
|
33
|
+
|
34
|
+
* `--out url` updates:
|
35
|
+
* supports redirects
|
36
|
+
* use `PUT` method by default
|
37
|
+
* use a cURL like options (for example: `cucumber --out 'http://example.com -X POST -H Content-Type: json`)
|
38
|
+
|
39
|
+
## [4.0.0.rc.5](https://github.com/cucumber/cucumber-ruby/compare/v4.0.0.rc.4...4.0.0.rc.5)
|
14
40
|
|
15
41
|
### Added
|
16
42
|
|
17
|
-
|
43
|
+
* New html formatter enabled by option `--format html --out report.html`.
|
44
|
+
|
45
|
+
* Accept `--out URL` to POST results to a web server
|
46
|
+
If a URL is used as output, the output will be sent with a POST request.
|
47
|
+
This can be overridden by specifying e.g. `http-method=PUT` as a query parameter.
|
48
|
+
Other `http-` prefixed query parameters will be converted to request headers
|
49
|
+
(with the `http-` prefix stripped off).
|
50
|
+
|
51
|
+
|
52
|
+
## [4.0.0.rc.4](https://github.com/cucumber/cucumber-ruby/compare/v4.0.0.rc.3...4.0.0.rc.4)
|
53
|
+
|
54
|
+
### Added
|
55
|
+
|
56
|
+
* Add `message`formatter which produces `Cucumber::Messages` ndjson output.
|
57
|
+
* Comply with [`cucumber-compatibility-kit](https://github.com/cucumber/cucumber/tree/master/compatibility-kit)
|
58
|
+
* Methods `log` and `attach` can be used in step definitions to attach text or images
|
18
59
|
|
19
60
|
### Deprecated
|
20
61
|
|
62
|
+
* `--format=json` in favor of the `message` formatter and the stand-alone JSON formatter
|
63
|
+
* `puts` in step definitions in favor of `log` ([cucumber#897](https://github.com/cucumber/cucumber/issues/897))
|
64
|
+
* `embed` in step definitions in favor of `attach` ([cucumber#897](https://github.com/cucumber/cucumber/issues/897))
|
65
|
+
|
66
|
+
|
67
|
+
## [4.0.0.rc.3](https://github.com/cucumber/cucumber-ruby/compare/v4.0.0.rc.2...v4.0.0.rc.3)
|
68
|
+
|
69
|
+
### Changed
|
70
|
+
|
71
|
+
* Update to cucumber-wire 1.1.
|
72
|
+
|
73
|
+
|
74
|
+
## [4.0.0.rc.2](https://github.com/cucumber/cucumber-ruby/compare/v4.0.0.rc.1...v4.0.0.rc.2)
|
75
|
+
|
76
|
+
### Added
|
77
|
+
* There is a new methodology in Cucumber for how the auto-loader works
|
78
|
+
* The old `load` behaviour is now replaced with a newer `require` behaviour
|
79
|
+
* Cucumber will (From version 4), now auto-load files using the `require` method
|
80
|
+
* If you wish to alter this, then you can set a top level config option: `Cucumber.use_legacy_autoloader`
|
81
|
+
* Like most config options, setting this inside a `spec_helper.rb` or `env.rb` file is advised
|
82
|
+
* For more information on this change, including why it was made. Please read this
|
83
|
+
[Blog Post](www.google.com)
|
84
|
+
([#1349](https://github.com/cucumber/cucumber-ruby/pull/1349),
|
85
|
+
[#1043](https://github.com/cucumber/cucumber-ruby/issues/1043)
|
86
|
+
[luke-hill](https://github.com/luke-hill))
|
87
|
+
|
88
|
+
### Changed
|
89
|
+
* Going forward the minimum ruby version for all cucumber based gems is 2.3
|
90
|
+
([luke-hill](https://github.com/luke-hill))
|
91
|
+
|
21
92
|
### Removed
|
93
|
+
* Removed Travis publish job for cucumber-pro(a.k.a. jam)
|
94
|
+
([#1350](https://github.com/cucumber/cucumber-ruby/pull/1350)
|
95
|
+
[luke-hill](https://github.com/luke-hill))
|
96
|
+
|
97
|
+
* Drop support for JRuby. We may add this back if new versions of protobuf for JRuby
|
98
|
+
start working, or if someone can make the build pass with an older version.
|
99
|
+
All this means is we're ok to make releases while the jruby CI job is failing.
|
100
|
+
|
101
|
+
([aslakhellesoy](https://github.com/aslakhellesoy))
|
102
|
+
|
103
|
+
* Remove `dots-formatter introduced in `4.0.0rc1`
|
22
104
|
|
23
105
|
### Fixed
|
24
106
|
|
25
|
-
|
107
|
+
* Fix the placeholder expansions in the json formatter
|
108
|
+
([#1361](https://github.com/cucumber/cucumber-ruby/pull/1361)
|
109
|
+
[brasmusson](https://github.com/brasmusson))
|
110
|
+
* Fix seed printed in cucumber UI to match the seed that was actually used.
|
111
|
+
([#1329](https://github.com/cucumber/cucumber-ruby/pull/1329)
|
112
|
+
[deivid-rodriguez](https://github.com/deivid-rodriguez))
|
113
|
+
* Make SIGINT/`Ctrl+c` behavior consistent with SIGTERM/`kill` behavior - now first invocation causes existing scenario to stop running and jump to `at_exit`, second invocation causes immediate exit. Before that first invocation only instructed Cucumber to exit after scenario and second invocation caused immediate exit skipping `at_exit`.
|
114
|
+
([#1353](https://github.com/cucumber/cucumber-ruby/pull/1353)
|
115
|
+
[akostadinov](https://github.com/akostadinov))
|
26
116
|
|
27
117
|
### Improved
|
28
118
|
|
119
|
+
* Filter out any lines containing `site_ruby` from stacktrace
|
120
|
+
|
29
121
|
## [4.0.0.rc.1](https://github.com/cucumber/cucumber-ruby/compare/v3.1.2...v4.0.0.rc.1) (2018-09-29)
|
30
122
|
|
31
123
|
### Added
|
@@ -50,6 +142,7 @@ Please visit [cucumber/CONTRIBUTING.md](https://github.com/cucumber/cucumber/blo
|
|
50
142
|
* Let the Pretty Formatter use events.
|
51
143
|
([#1305](https://github.com/cucumber/cucumber-ruby/pull/1305)
|
52
144
|
[brasmusson](https://github.com/brasmusson))
|
145
|
+
* Use single quotes in generated template steps ([#1323](https://github.com/cucumber/cucumber-ruby/pull/1323) [acant](https://github.com/acant))
|
53
146
|
|
54
147
|
### Removed
|
55
148
|
|
@@ -675,7 +768,7 @@ all.
|
|
675
768
|
* Upgrade Gherkin version to remove warnings when running on JRuby. ([#393](https://github.com/cucumber/cucumber-ruby/issues/393) Oleg Sukhodolsky)
|
676
769
|
* Do not use TagExpression.eval() which is deprecated in Gherkin 2.11.7 ([#420](https://github.com/cucumber/cucumber-ruby/issues/420) Oleg Sukhodolsky)
|
677
770
|
|
678
|
-
##
|
771
|
+
## 1.2.4
|
679
772
|
|
680
773
|
Yanked. See ([#428](https://github.com/cucumber/cucumber-ruby/issues/428)).
|
681
774
|
|
data/CONTRIBUTING.md
CHANGED
@@ -55,7 +55,7 @@ gem 'byebug'
|
|
55
55
|
If you are new to the project or to OSS, check the label
|
56
56
|
[Easy](https://github.com/cucumber/cucumber-ruby/labels/Easy). Also, you can
|
57
57
|
help us to correct style violations reported here:
|
58
|
-
[.rubocop_todo.
|
58
|
+
[.rubocop_todo.yml](https://github.com/cucumber/cucumber-ruby/blob/master/.rubocop_todo.yml).
|
59
59
|
|
60
60
|
## Release Process
|
61
61
|
|
@@ -69,20 +69,3 @@ Now release it
|
|
69
69
|
git commit -m "Release X.Y.Z"
|
70
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
71
|
rake release
|
72
|
-
|
73
|
-
## Gaining Release Karma
|
74
|
-
|
75
|
-
To become a release manager, create a pull request adding your name to the list below, and include your Rubygems email address in the ticket. One of the existing Release managers will then add you.
|
76
|
-
|
77
|
-
Current release managers:
|
78
|
-
* [Matt Wynne](https://rubygems.org/profiles/mattwynne)
|
79
|
-
* [Aslak Hellesøy](https://rubygems.org/profiles/aslakhellesoy)
|
80
|
-
* [Oleg Sukhodolsky](https://rubygems.org/profiles/os97673)
|
81
|
-
* [Steve Tooke](https://rubygems.org/profiles/tooky)
|
82
|
-
* [Björn Rasmusson](https://rubygems.org/profiles/brasmusson)
|
83
|
-
* [Andrew Walter](https://rubygems.org/profiles/xtrasimplicity)
|
84
|
-
|
85
|
-
To grant release karma, issue the following commands:
|
86
|
-
|
87
|
-
gem owner cucumber --add <NEW OWNER RUBYGEMS EMAIL>
|
88
|
-
gem owner cucumber-core --add <NEW OWNER RUBYGEMS EMAIL>
|
data/README.md
CHANGED
@@ -5,7 +5,6 @@
|
|
5
5
|
|
6
6
|
[](https://codeclimate.com/github/cucumber/cucumber-ruby)
|
7
7
|
[](https://coveralls.io/r/cucumber/cucumber-ruby?branch=master)
|
8
|
-
[](https://gemnasium.com/cucumber/cucumber-ruby)
|
9
8
|
|
10
9
|
# Cucumber
|
11
10
|
|
@@ -16,8 +15,8 @@ your team.
|
|
16
15
|
|
17
16
|
Where to get more info:
|
18
17
|
|
19
|
-
* The main website: https://cucumber.io/
|
20
|
-
* Documentation: https://
|
18
|
+
* The main website: https://cucumber.io/
|
19
|
+
* Documentation: https://cucumber.io/docs
|
21
20
|
* Ruby API Documentation: http://www.rubydoc.info/github/cucumber/cucumber-ruby/
|
22
21
|
* Support forum: https://groups.google.com/group/cukes
|
23
22
|
* Chat: ([Slack](https://cucumber.io/support#slack) and [Gitter](https://cucumber.io/support#gitter))
|
@@ -25,11 +24,11 @@ Where to get more info:
|
|
25
24
|
See [CONTRIBUTING.md](CONTRIBUTING.md) for info on contributing to Cucumber.
|
26
25
|
|
27
26
|
## Supported platforms
|
27
|
+
* Ruby 2.6
|
28
28
|
* Ruby 2.5
|
29
29
|
* Ruby 2.4
|
30
30
|
* Ruby 2.3
|
31
|
-
*
|
32
|
-
* JRuby 9.1
|
31
|
+
* JRuby 9.2 (with [some limitations](https://github.com/cucumber/cucumber-ruby/blob/master/docs/jruby-limitations.md))
|
33
32
|
|
34
33
|
## Code of Conduct
|
35
34
|
|
@@ -80,10 +80,10 @@ module Autotest::CucumberMixin
|
|
80
80
|
open("| #{cmd}", 'r') do |f| # rubocop:disable Security/Open
|
81
81
|
until f.eof?
|
82
82
|
c = f.getc || break
|
83
|
-
|
83
|
+
print(c)
|
84
84
|
line << c
|
85
85
|
next unless c == "\n"
|
86
|
-
results <<
|
86
|
+
results << line.join
|
87
87
|
line.clear
|
88
88
|
end
|
89
89
|
end
|
@@ -96,14 +96,6 @@ module Autotest::CucumberMixin
|
|
96
96
|
hook :ran_features
|
97
97
|
end
|
98
98
|
|
99
|
-
def put_command(cmd)
|
100
|
-
RUBY_VERSION >= '1.9' ? print(cmd) : putcmd(c)
|
101
|
-
end
|
102
|
-
|
103
|
-
def join_line
|
104
|
-
RUBY_VERSION >= '1.9' ? line.join : line.pack('c*')
|
105
|
-
end
|
106
|
-
|
107
99
|
def make_cucumber_cmd(features_to_run, _dirty_features_filename)
|
108
100
|
return '' if features_to_run.empty?
|
109
101
|
|
data/lib/cucumber.rb
CHANGED
data/lib/cucumber/cli/main.rb
CHANGED
data/lib/cucumber/cli/options.rb
CHANGED
@@ -13,7 +13,6 @@ module Cucumber
|
|
13
13
|
BUILTIN_FORMATS = {
|
14
14
|
'pretty' => ['Cucumber::Formatter::Pretty', 'Prints the feature as is - in colours.'],
|
15
15
|
'progress' => ['Cucumber::Formatter::Progress', 'Prints one character per scenario.'],
|
16
|
-
'dots' => ['Cucumber::Formatter::Dots', 'Simple progress output to console'],
|
17
16
|
'rerun' => ['Cucumber::Formatter::Rerun', 'Prints failing files with line numbers.'],
|
18
17
|
'usage' => ['Cucumber::Formatter::Usage', "Prints where step definitions are used.\n" \
|
19
18
|
"#{INDENT}The slowest step definitions (with duration) are\n" \
|
@@ -23,7 +22,9 @@ module Cucumber
|
|
23
22
|
'stepdefs' => ['Cucumber::Formatter::Stepdefs', "Prints All step definitions with their locations. Same as\n" \
|
24
23
|
"#{INDENT}the usage formatter, except that steps are not printed."],
|
25
24
|
'junit' => ['Cucumber::Formatter::Junit', 'Generates a report similar to Ant+JUnit.'],
|
26
|
-
'json' => ['Cucumber::Formatter::Json', 'Prints the feature as JSON'],
|
25
|
+
'json' => ['Cucumber::Formatter::Json', '[DEPRECATED] Prints the feature as JSON'],
|
26
|
+
'message' => ['Cucumber::Formatter::Message', 'Outputs protobuf messages'],
|
27
|
+
'html' => ['Cucumber::Formatter::HTML', 'Outputs HTML report'],
|
27
28
|
'summary' => ['Cucumber::Formatter::Summary', 'Summary output of feature and scenarios']
|
28
29
|
}.freeze
|
29
30
|
max = BUILTIN_FORMATS.keys.map(&:length).max
|
@@ -104,7 +105,7 @@ module Cucumber
|
|
104
105
|
add_option :formats, [*parse_formats(v), @out_stream]
|
105
106
|
end
|
106
107
|
opts.on('--init', *init_msg) { |_v| initialize_project }
|
107
|
-
opts.on('-o', '--out [FILE|DIR]', *out_msg) { |v| out_stream v }
|
108
|
+
opts.on('-o', '--out [FILE|DIR|URL]', *out_msg) { |v| out_stream v }
|
108
109
|
opts.on('-t TAG_EXPRESSION', '--tags TAG_EXPRESSION', *tags_msg) { |v| add_tag v }
|
109
110
|
opts.on('-n NAME', '--name NAME', *name_msg) { |v| add_option :name_regexps, /#{v}/ }
|
110
111
|
opts.on('-e', '--exclude PATTERN', *exclude_msg) { |v| add_option :excludes, Regexp.new(v) }
|
@@ -189,10 +190,7 @@ Specify SEED to reproduce the shuffling from a previous run.
|
|
189
190
|
end
|
190
191
|
|
191
192
|
def dry_run_msg
|
192
|
-
[
|
193
|
-
'Invokes formatters without executing the steps.',
|
194
|
-
'This also omits the loading of your support/env.rb file if it exists.'
|
195
|
-
]
|
193
|
+
['Invokes formatters without executing the steps.']
|
196
194
|
end
|
197
195
|
|
198
196
|
def exclude_msg
|
@@ -298,10 +296,15 @@ Specify SEED to reproduce the shuffling from a previous run.
|
|
298
296
|
|
299
297
|
def out_msg
|
300
298
|
[
|
301
|
-
'Write output to a file/directory instead of STDOUT. This option',
|
299
|
+
'Write output to a file/directory/URL instead of STDOUT. This option',
|
302
300
|
'applies to the previously specified --format, or the',
|
303
301
|
'default format if no format is specified. Check the specific',
|
304
|
-
"formatter's docs to see whether to pass a file or
|
302
|
+
"formatter's docs to see whether to pass a file, dir or URL.",
|
303
|
+
"\n",
|
304
|
+
'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.'
|
305
308
|
]
|
306
309
|
end
|
307
310
|
|
@@ -309,11 +312,13 @@ Specify SEED to reproduce the shuffling from a previous run.
|
|
309
312
|
[
|
310
313
|
'Require files before executing the features. If this',
|
311
314
|
'option is not specified, all *.rb files that are',
|
312
|
-
'siblings or below the features will be loaded auto-',
|
315
|
+
'siblings of or below the features will be loaded auto-',
|
313
316
|
'matically. Automatic loading is disabled when this',
|
314
|
-
'option is specified
|
315
|
-
'Files
|
316
|
-
'loaded first
|
317
|
+
'option is specified; all loading becomes explicit.',
|
318
|
+
'Files in directories named "support" are still always',
|
319
|
+
'loaded first when their parent directories are',
|
320
|
+
'required or if the "support" directoires themselves are',
|
321
|
+
'explicitly required.',
|
317
322
|
'This option can be specified multiple times.'
|
318
323
|
]
|
319
324
|
end
|
@@ -51,14 +51,29 @@ Defined profiles in cucumber.yml:
|
|
51
51
|
# Loads the profile, processing it through ERB and YAML, and returns it as a hash.
|
52
52
|
def cucumber_yml
|
53
53
|
return @cucumber_yml if @cucumber_yml
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
54
|
+
|
55
|
+
ensure_configuration_file_exists
|
56
|
+
process_configuration_file_with_erb
|
57
|
+
load_configuration
|
58
|
+
|
59
|
+
if @cucumber_yml.nil? || !@cucumber_yml.is_a?(Hash)
|
60
|
+
raise(YmlLoadError, 'cucumber.yml was found, but was blank or malformed. ' \
|
61
|
+
"Please refer to cucumber's documentation on correct profile usage.\n")
|
58
62
|
end
|
59
63
|
|
64
|
+
@cucumber_yml
|
65
|
+
end
|
66
|
+
|
67
|
+
def ensure_configuration_file_exists
|
68
|
+
return if cucumber_yml_defined?
|
69
|
+
|
70
|
+
raise(ProfilesNotDefinedError, "cucumber.yml was not found. Current directory is #{Dir.pwd}." \
|
71
|
+
"Please refer to cucumber's documentation on defining profiles in cucumber.yml. You must define" \
|
72
|
+
"a 'default' profile to use the cucumber command without any arguments.\nType 'cucumber --help' for usage.\n")
|
73
|
+
end
|
74
|
+
|
75
|
+
def process_configuration_file_with_erb
|
60
76
|
require 'erb'
|
61
|
-
require 'yaml'
|
62
77
|
begin
|
63
78
|
@cucumber_erb = if RUBY_VERSION >= '2.6'
|
64
79
|
ERB.new(IO.read(cucumber_file), trim_mode: '%').result(binding)
|
@@ -68,19 +83,15 @@ Defined profiles in cucumber.yml:
|
|
68
83
|
rescue StandardError
|
69
84
|
raise(YmlLoadError, "cucumber.yml was found, but could not be parsed with ERB. Please refer to cucumber's documentation on correct profile usage.\n#{$ERROR_INFO.inspect}")
|
70
85
|
end
|
86
|
+
end
|
71
87
|
|
88
|
+
def load_configuration
|
89
|
+
require 'yaml'
|
72
90
|
begin
|
73
91
|
@cucumber_yml = YAML.load(@cucumber_erb) # rubocop:disable Security/YAMLLoad
|
74
92
|
rescue StandardError
|
75
93
|
raise(YmlLoadError, "cucumber.yml was found, but could not be parsed. Please refer to cucumber's documentation on correct profile usage.\n")
|
76
94
|
end
|
77
|
-
|
78
|
-
if @cucumber_yml.nil? || !@cucumber_yml.is_a?(Hash)
|
79
|
-
raise(YmlLoadError, 'cucumber.yml was found, but was blank or malformed. ' \
|
80
|
-
"Please refer to cucumber's documentation on correct profile usage.\n")
|
81
|
-
end
|
82
|
-
|
83
|
-
@cucumber_yml
|
84
95
|
end
|
85
96
|
|
86
97
|
# Locates cucumber.yml file. The file can end in .yml or .yaml,
|
@@ -3,6 +3,7 @@
|
|
3
3
|
require 'cucumber/constantize'
|
4
4
|
require 'cucumber/cli/rerun_file'
|
5
5
|
require 'cucumber/events'
|
6
|
+
require 'cucumber/messages'
|
6
7
|
require 'cucumber/core/event_bus'
|
7
8
|
require 'cucumber/core/test/result'
|
8
9
|
require 'forwardable'
|
@@ -54,7 +55,7 @@ module Cucumber
|
|
54
55
|
end
|
55
56
|
|
56
57
|
def seed
|
57
|
-
|
58
|
+
@options[:seed]
|
58
59
|
end
|
59
60
|
|
60
61
|
def dry_run?
|
@@ -168,9 +169,13 @@ module Cucumber
|
|
168
169
|
|
169
170
|
def support_to_load
|
170
171
|
support_files = all_files_to_load.select { |f| f =~ %r{/support/} }
|
172
|
+
|
173
|
+
# env_files are separated from other_files so we can ensure env files
|
174
|
+
# load first.
|
175
|
+
#
|
171
176
|
env_files = support_files.select { |f| f =~ %r{/support/env\..*} }
|
172
177
|
other_files = support_files - env_files
|
173
|
-
|
178
|
+
env_files.reverse + other_files.reverse
|
174
179
|
end
|
175
180
|
|
176
181
|
def all_files_to_load
|
@@ -238,6 +243,10 @@ module Cucumber
|
|
238
243
|
@options[:event_bus]
|
239
244
|
end
|
240
245
|
|
246
|
+
def id_generator
|
247
|
+
@id_generator ||= Cucumber::Messages::IdGenerator::UUID.new
|
248
|
+
end
|
249
|
+
|
241
250
|
private
|
242
251
|
|
243
252
|
def default_options
|
data/lib/cucumber/deprecate.rb
CHANGED
@@ -5,13 +5,37 @@ require 'cucumber/gherkin/formatter/ansi_escapes'
|
|
5
5
|
|
6
6
|
module Cucumber
|
7
7
|
module Deprecate
|
8
|
-
|
9
|
-
|
8
|
+
class AnsiString
|
9
|
+
include Cucumber::Gherkin::Formatter::AnsiEscapes
|
10
|
+
|
11
|
+
def self.failure_message(message)
|
12
|
+
AnsiString.new.failure_message(message)
|
13
|
+
end
|
14
|
+
|
15
|
+
def failure_message(message)
|
16
|
+
failed + message + reset
|
17
|
+
end
|
18
|
+
end
|
10
19
|
|
20
|
+
class CliOption
|
21
|
+
def self.deprecate(stream, option, message, remove_after_version)
|
22
|
+
return if stream.nil?
|
23
|
+
stream.puts(
|
24
|
+
AnsiString.failure_message(
|
25
|
+
"\nWARNING: #{option} is deprecated" \
|
26
|
+
" and will be removed after version #{remove_after_version}.\n#{message}.\n"
|
27
|
+
)
|
28
|
+
)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
module ForUsers
|
11
33
|
def self.call(message, method, remove_after_version)
|
12
|
-
STDERR.puts
|
13
|
-
|
14
|
-
|
34
|
+
STDERR.puts AnsiString.failure_message(
|
35
|
+
"\nWARNING: ##{method} is deprecated" \
|
36
|
+
" and will be removed after version #{remove_after_version}. #{message}.\n" \
|
37
|
+
"(Called from #{caller(3..3).first})"
|
38
|
+
)
|
15
39
|
end
|
16
40
|
end
|
17
41
|
|