gurke 3.5.0 → 3.6.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -1
- data/lib/gurke/cli.rb +0 -2
- data/lib/gurke/configuration.rb +4 -0
- data/lib/gurke/feature.rb +12 -0
- data/lib/gurke/reporters/compact_reporter.rb +5 -5
- data/lib/gurke/reporters/default_reporter.rb +7 -6
- data/lib/gurke/runner.rb +2 -2
- data/lib/gurke/scenario.rb +14 -0
- data/lib/gurke/step.rb +4 -0
- data/lib/gurke/version.rb +1 -1
- data/spec/gurke/reporters/compact_reporter_spec.rb +20 -20
- data/spec/gurke/reporters/default_reporter_spec.rb +75 -75
- data/spec/spec_helper.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e0e270f3440d5c7d4ebbf8f87fffc06d354db879b7bfb1e8b169e85fccee50c
|
4
|
+
data.tar.gz: b8aaf0dec747886d30eb745ee8464f7b43f83a68fd3e6ca7b6dcffbc979a52a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 234bc4e6ad8283e1d72bd42d40694f6a49f0a5638f0a0a6e28ddd8edecb600bea9e918f9ff4c83e05a315adebc1aa188603e2378a2ed98575315c866937fa93a
|
7
|
+
data.tar.gz: fa4436190a9cae9dcbc9c00492973dfcdc9b5007330c42e31ce72b7cf1ca86033d16f16168740eef8de892ff7d8648cd69005131487671deb135dc647cef4ed7
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
7
7
|
|
8
8
|
## [Unreleased]
|
9
9
|
|
10
|
+
## [3.6.0] - 2025-04-10
|
11
|
+
|
12
|
+
### Added
|
13
|
+
|
14
|
+
- Expose `#id`, `#name`, `#path`, `#line`, `#state`, `#failed?`, `#pending?`, `#passed?`, and `#aborted?` in hook context if available
|
15
|
+
|
16
|
+
## [3.5.1] - 2025-04-10
|
17
|
+
|
18
|
+
### Changed
|
19
|
+
|
20
|
+
- Print spaces on empty lines to improve logging GitLab CI/CD
|
21
|
+
|
10
22
|
## [3.5.0] - 2025-04-09
|
11
23
|
|
12
24
|
### Added
|
@@ -136,7 +148,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
136
148
|
|
137
149
|
## [1.0.0] - 2013-12-04
|
138
150
|
|
139
|
-
[Unreleased]: https://github.com/jgraichen/gurke/compare/v3.
|
151
|
+
[Unreleased]: https://github.com/jgraichen/gurke/compare/v3.6.0...HEAD
|
152
|
+
[3.6.0]: https://github.com/jgraichen/gurke/compare/v3.5.1...v3.6.0
|
153
|
+
[3.5.1]: https://github.com/jgraichen/gurke/compare/v3.5.0...v3.5.1
|
140
154
|
[3.5.0]: https://github.com/jgraichen/gurke/compare/v3.4.0...v3.5.0
|
141
155
|
[3.4.0]: https://github.com/jgraichen/gurke/compare/v3.3.5...v3.4.0
|
142
156
|
[3.3.5]: https://github.com/jgraichen/gurke/compare/v3.3.4...v3.3.5
|
data/lib/gurke/cli.rb
CHANGED
data/lib/gurke/configuration.rb
CHANGED
@@ -161,6 +161,10 @@ module Gurke
|
|
161
161
|
class Context
|
162
162
|
extend Forwardable
|
163
163
|
|
164
|
+
def_delegators :@context,
|
165
|
+
:id, :name, :path, :line, :state,
|
166
|
+
:failed?, :pending?, :passed?, :aborted?
|
167
|
+
|
164
168
|
def initialize(context, block)
|
165
169
|
@context = context
|
166
170
|
@block = block
|
data/lib/gurke/feature.rb
CHANGED
@@ -43,6 +43,10 @@ module Gurke
|
|
43
43
|
@raw = raw
|
44
44
|
end
|
45
45
|
|
46
|
+
def id
|
47
|
+
raw.id
|
48
|
+
end
|
49
|
+
|
46
50
|
# Return name of this feature.
|
47
51
|
#
|
48
52
|
# @return [String] Feature name.
|
@@ -63,6 +67,14 @@ module Gurke
|
|
63
67
|
scenarios.any?(&:pending?)
|
64
68
|
end
|
65
69
|
|
70
|
+
def aborted?
|
71
|
+
scenarios.any?(&:aborted?)
|
72
|
+
end
|
73
|
+
|
74
|
+
def success?
|
75
|
+
scenarios.all?(&:success?)
|
76
|
+
end
|
77
|
+
|
66
78
|
def self.new(*args)
|
67
79
|
if args.size == 1 && (f = args.first).is_a?(self)
|
68
80
|
super(f.file, f.line, f.tags, f.raw)
|
@@ -15,10 +15,10 @@ module Gurke::Reporters
|
|
15
15
|
return unless result.state == :failed
|
16
16
|
|
17
17
|
io.print red 'E'
|
18
|
+
io.puts
|
18
19
|
|
19
20
|
feature = scenario.feature
|
20
21
|
|
21
|
-
io.puts
|
22
22
|
io.print yellow('Feature')
|
23
23
|
io.print ': '
|
24
24
|
io.print scenario.feature.name
|
@@ -67,7 +67,7 @@ module Gurke::Reporters
|
|
67
67
|
|
68
68
|
exout = format_exception(result.exception, backtrace: true, indent: 6)
|
69
69
|
io.puts red exout
|
70
|
-
io.puts
|
70
|
+
io.puts ' '
|
71
71
|
end
|
72
72
|
|
73
73
|
def after_scenario(scenario)
|
@@ -78,13 +78,13 @@ module Gurke::Reporters
|
|
78
78
|
elsif scenario.passed?
|
79
79
|
io.print green '.'
|
80
80
|
elsif scenario.aborted?
|
81
|
-
io.puts
|
81
|
+
io.puts ' '
|
82
82
|
end
|
83
83
|
end
|
84
84
|
|
85
85
|
def after_features(features)
|
86
|
-
io.puts
|
87
|
-
io.puts
|
86
|
+
io.puts ' '
|
87
|
+
io.puts ' '
|
88
88
|
|
89
89
|
scenarios = features.map(&:scenarios).flatten
|
90
90
|
|
@@ -27,7 +27,7 @@ module Gurke::Reporters
|
|
27
27
|
|
28
28
|
io.print light_black(feature.description.gsub(/^/, ' '))
|
29
29
|
io.puts
|
30
|
-
io.puts
|
30
|
+
io.puts ' '
|
31
31
|
end
|
32
32
|
|
33
33
|
def before_scenario(scenario)
|
@@ -72,18 +72,18 @@ module Gurke::Reporters
|
|
72
72
|
|
73
73
|
def retry_scenario(scenario)
|
74
74
|
if scenario.flaky?
|
75
|
-
io.print "\n Retry flaky scenario due to previous failure:\n\n"
|
75
|
+
io.print " \n Retry flaky scenario due to previous failure:\n \n"
|
76
76
|
else
|
77
|
-
io.print "\n Retry scenario due to previous failure:\n\n"
|
77
|
+
io.print " \n Retry scenario due to previous failure:\n \n"
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
81
|
def after_scenario(*)
|
82
|
-
io.puts
|
82
|
+
io.puts ' '
|
83
83
|
end
|
84
84
|
|
85
85
|
def after_feature(*)
|
86
|
-
io.puts
|
86
|
+
io.puts ' '
|
87
87
|
end
|
88
88
|
|
89
89
|
def after_features(features)
|
@@ -108,7 +108,7 @@ module Gurke::Reporters
|
|
108
108
|
io.puts green message
|
109
109
|
end
|
110
110
|
|
111
|
-
io.puts
|
111
|
+
io.puts ' '
|
112
112
|
end
|
113
113
|
|
114
114
|
protected
|
@@ -140,6 +140,7 @@ module Gurke::Reporters
|
|
140
140
|
|
141
141
|
def print_exception(exception)
|
142
142
|
io.puts red format_exception(exception).gsub(/^/, ' ')
|
143
|
+
io.print ' '
|
143
144
|
end
|
144
145
|
|
145
146
|
def format_location(obj)
|
data/lib/gurke/runner.rb
CHANGED
@@ -38,8 +38,8 @@ module Gurke
|
|
38
38
|
scenario.flaky? ? config.flaky_retries : config.default_retries
|
39
39
|
end
|
40
40
|
|
41
|
-
def hook(scope,
|
42
|
-
config.hooks[scope].run world,
|
41
|
+
def hook(scope, context, world, &block)
|
42
|
+
config.hooks[scope].run(context, world, &block)
|
43
43
|
end
|
44
44
|
|
45
45
|
def with_filtered_backtrace
|
data/lib/gurke/scenario.rb
CHANGED
@@ -29,8 +29,18 @@ module Gurke
|
|
29
29
|
#
|
30
30
|
attr_reader :steps
|
31
31
|
|
32
|
+
# List of this scenario's tags.
|
33
|
+
#
|
34
|
+
# @return [Array<String>] Steps.
|
35
|
+
#
|
32
36
|
attr_reader :tags
|
33
37
|
|
38
|
+
# Internal scenario state
|
39
|
+
#
|
40
|
+
# @return [Nil|Symbol] state
|
41
|
+
#
|
42
|
+
attr_reader :state
|
43
|
+
|
34
44
|
# @api private
|
35
45
|
attr_reader :raw
|
36
46
|
|
@@ -46,6 +56,10 @@ module Gurke
|
|
46
56
|
@state = nil
|
47
57
|
end
|
48
58
|
|
59
|
+
def id
|
60
|
+
raw.id
|
61
|
+
end
|
62
|
+
|
49
63
|
# Return name of the scenario.
|
50
64
|
#
|
51
65
|
# @return [String] Scenario name.
|
data/lib/gurke/step.rb
CHANGED
data/lib/gurke/version.rb
CHANGED
@@ -127,20 +127,20 @@ RSpec.describe Gurke::Reporters::CompactReporter do
|
|
127
127
|
end
|
128
128
|
|
129
129
|
it do
|
130
|
-
expect(out).to eq
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
130
|
+
expect(out).to eq text(
|
131
|
+
'E',
|
132
|
+
'Feature: Demo feature # features/file.feature:1',
|
133
|
+
' Scenario: Running the scenario # features/file.feature:5',
|
134
|
+
' Given the scenario is passing',
|
135
|
+
' RuntimeError: An error occurred',
|
136
|
+
" /path/to/file.rb:5:in `block (4 levels) in <top (required)>'",
|
137
|
+
" /path/to/file.rb:24:in in `fail_with'",
|
138
|
+
' caused by: IOError: Socket closed',
|
139
|
+
" script.rb:5:in `a'",
|
140
|
+
" script.rb:10:in `b'",
|
141
|
+
' ',
|
142
|
+
'',
|
143
|
+
)
|
144
144
|
end
|
145
145
|
end
|
146
146
|
end
|
@@ -187,12 +187,12 @@ RSpec.describe Gurke::Reporters::CompactReporter do
|
|
187
187
|
let(:action) { [:after_features, []] }
|
188
188
|
|
189
189
|
it do
|
190
|
-
expect(out).to eq
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
190
|
+
expect(out).to eq text(
|
191
|
+
' ',
|
192
|
+
' ',
|
193
|
+
'0 scenarios: 0 passed, 0 failing, 0 pending',
|
194
|
+
'',
|
195
|
+
)
|
196
196
|
end
|
197
197
|
end
|
198
198
|
end
|
@@ -30,28 +30,28 @@ RSpec.describe Gurke::Reporters::DefaultReporter do
|
|
30
30
|
end
|
31
31
|
|
32
32
|
it do
|
33
|
-
expect(out).to eq
|
34
|
-
Feature: Demo feature # features/file.feature:1
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
33
|
+
expect(out).to eq text(
|
34
|
+
'Feature: Demo feature # features/file.feature:1',
|
35
|
+
' As a developer',
|
36
|
+
' I would like have this spec passed',
|
37
|
+
' In order to work on',
|
38
|
+
' ',
|
39
|
+
'',
|
40
|
+
)
|
41
41
|
end
|
42
42
|
|
43
43
|
context 'with colors' do
|
44
44
|
let(:color) { true }
|
45
45
|
|
46
46
|
it 'outputs ASCII color codes' do
|
47
|
-
expect(out).to eq
|
48
|
-
\e[0;33;49mFeature\e[0m: Demo feature \e[0;90;49m# features/file.feature:1\e[0m
|
49
|
-
\e[0;90;49m As a developer
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
47
|
+
expect(out).to eq text(
|
48
|
+
"\e[0;33;49mFeature\e[0m: Demo feature \e[0;90;49m# features/file.feature:1\e[0m",
|
49
|
+
"\e[0;90;49m As a developer",
|
50
|
+
' I would like have this spec passed',
|
51
|
+
" In order to work on\e[0m",
|
52
|
+
' ',
|
53
|
+
'',
|
54
|
+
)
|
55
55
|
end
|
56
56
|
end
|
57
57
|
end
|
@@ -60,10 +60,10 @@ RSpec.describe Gurke::Reporters::DefaultReporter do
|
|
60
60
|
let(:action) { [:start_background, feature] }
|
61
61
|
|
62
62
|
it do
|
63
|
-
expect(out).to eq
|
64
|
-
|
65
|
-
|
66
|
-
|
63
|
+
expect(out).to eq text(
|
64
|
+
' Background:',
|
65
|
+
'',
|
66
|
+
)
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
@@ -76,10 +76,10 @@ RSpec.describe Gurke::Reporters::DefaultReporter do
|
|
76
76
|
end
|
77
77
|
|
78
78
|
it do
|
79
|
-
expect(out).to eq
|
80
|
-
|
81
|
-
|
82
|
-
|
79
|
+
expect(out).to eq text(
|
80
|
+
' Scenario: Running the scenario # features/file.feature:5',
|
81
|
+
'',
|
82
|
+
)
|
83
83
|
end
|
84
84
|
end
|
85
85
|
|
@@ -91,9 +91,9 @@ RSpec.describe Gurke::Reporters::DefaultReporter do
|
|
91
91
|
end
|
92
92
|
|
93
93
|
it do
|
94
|
-
expect(out).to eq
|
95
|
-
|
96
|
-
|
94
|
+
expect(out).to eq text(
|
95
|
+
' Given the scenario is passing',
|
96
|
+
)
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
@@ -109,10 +109,10 @@ RSpec.describe Gurke::Reporters::DefaultReporter do
|
|
109
109
|
let(:state) { :passed }
|
110
110
|
|
111
111
|
it do
|
112
|
-
expect(out).to eq
|
113
|
-
|
114
|
-
|
115
|
-
|
112
|
+
expect(out).to eq text(
|
113
|
+
' (passed)',
|
114
|
+
'',
|
115
|
+
)
|
116
116
|
end
|
117
117
|
end
|
118
118
|
|
@@ -120,10 +120,10 @@ RSpec.describe Gurke::Reporters::DefaultReporter do
|
|
120
120
|
let(:state) { :pending }
|
121
121
|
|
122
122
|
it do
|
123
|
-
expect(out).to eq
|
124
|
-
|
125
|
-
|
126
|
-
|
123
|
+
expect(out).to eq text(
|
124
|
+
' (pending)',
|
125
|
+
'',
|
126
|
+
)
|
127
127
|
end
|
128
128
|
end
|
129
129
|
|
@@ -131,10 +131,10 @@ RSpec.describe Gurke::Reporters::DefaultReporter do
|
|
131
131
|
let(:state) { nil }
|
132
132
|
|
133
133
|
it do
|
134
|
-
expect(out).to eq
|
135
|
-
|
136
|
-
|
137
|
-
|
134
|
+
expect(out).to eq text(
|
135
|
+
' (skipped)',
|
136
|
+
'',
|
137
|
+
)
|
138
138
|
end
|
139
139
|
end
|
140
140
|
|
@@ -159,17 +159,17 @@ RSpec.describe Gurke::Reporters::DefaultReporter do
|
|
159
159
|
end
|
160
160
|
|
161
161
|
it do
|
162
|
-
expect(out).to eq
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
162
|
+
expect(out).to eq text(
|
163
|
+
' (failure)',
|
164
|
+
' RuntimeError: An error occurred',
|
165
|
+
" /path/to/file.rb:5:in `block (4 levels) in <top (required)>'",
|
166
|
+
" /path/to/file.rb:24:in in `fail_with'",
|
167
|
+
' caused by: IOError: Socket closed',
|
168
|
+
" script.rb:5:in `a'",
|
169
|
+
" script.rb:10:in `b'",
|
170
|
+
' ',
|
171
|
+
'',
|
172
|
+
)
|
173
173
|
end
|
174
174
|
end
|
175
175
|
end
|
@@ -183,12 +183,12 @@ RSpec.describe Gurke::Reporters::DefaultReporter do
|
|
183
183
|
end
|
184
184
|
|
185
185
|
it do
|
186
|
-
expect(out).to eq
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
186
|
+
expect(out).to eq text(
|
187
|
+
' ',
|
188
|
+
' Retry scenario due to previous failure:',
|
189
|
+
' ',
|
190
|
+
'',
|
191
|
+
)
|
192
192
|
end
|
193
193
|
end
|
194
194
|
|
@@ -198,12 +198,12 @@ RSpec.describe Gurke::Reporters::DefaultReporter do
|
|
198
198
|
end
|
199
199
|
|
200
200
|
it do
|
201
|
-
expect(out).to eq
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
201
|
+
expect(out).to eq text(
|
202
|
+
' ',
|
203
|
+
' Retry flaky scenario due to previous failure:',
|
204
|
+
' ',
|
205
|
+
'',
|
206
|
+
)
|
207
207
|
end
|
208
208
|
end
|
209
209
|
end
|
@@ -212,10 +212,10 @@ RSpec.describe Gurke::Reporters::DefaultReporter do
|
|
212
212
|
let(:action) { [:after_scenario, scenario] }
|
213
213
|
|
214
214
|
it do
|
215
|
-
expect(out).to eq
|
216
|
-
|
217
|
-
|
218
|
-
|
215
|
+
expect(out).to eq text(
|
216
|
+
' ',
|
217
|
+
'',
|
218
|
+
)
|
219
219
|
end
|
220
220
|
end
|
221
221
|
|
@@ -223,10 +223,10 @@ RSpec.describe Gurke::Reporters::DefaultReporter do
|
|
223
223
|
let(:action) { [:after_feature, feature] }
|
224
224
|
|
225
225
|
it do
|
226
|
-
expect(out).to eq
|
227
|
-
|
228
|
-
|
229
|
-
|
226
|
+
expect(out).to eq text(
|
227
|
+
' ',
|
228
|
+
'',
|
229
|
+
)
|
230
230
|
end
|
231
231
|
end
|
232
232
|
|
@@ -234,11 +234,11 @@ RSpec.describe Gurke::Reporters::DefaultReporter do
|
|
234
234
|
let(:action) { [:after_features, []] }
|
235
235
|
|
236
236
|
it do
|
237
|
-
expect(out).to eq
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
237
|
+
expect(out).to eq text(
|
238
|
+
'0 scenarios: 0 failing, 0 pending',
|
239
|
+
' ',
|
240
|
+
'',
|
241
|
+
)
|
242
242
|
end
|
243
243
|
end
|
244
244
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gurke
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Graichen
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-04-
|
10
|
+
date: 2025-04-10 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: colorize
|