rspec-abq 1.0.6 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rspec/abq/extensions.rb +6 -1
- data/lib/rspec/abq/formatter.rb +47 -21
- data/lib/rspec/abq/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 29210d070dba423ba2bb9aad82deb1df9e4a4fb01e70bec05b1d728d20e29d5e
|
4
|
+
data.tar.gz: 1771fe5b152192dd256b29cc412526fc275c381c1c697cec4a51b6ae5a4b0174
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f89f037b50d88458b443c534ec78e20d9bbf4661d81cf68774f2bd7438a588cace8a991dfe101d1a4424a98956e186ba20f65d51f47d837ff5237dbf4b00a4f
|
7
|
+
data.tar.gz: 22bf4931dc4ee3639334e1e91451e0577591c215ad279802560d8ae7256b56a31a93fcb495b932f9e490658aa2e1bc23e1100c29ed735b0515312f1e9dae2c6f
|
data/lib/rspec/abq/extensions.rb
CHANGED
@@ -78,7 +78,12 @@ module RSpec
|
|
78
78
|
results_for_descendants = ordering_strategy.order(children).map { |child| child.run_with_abq(reporter) }.all?
|
79
79
|
result_for_this_group && results_for_descendants
|
80
80
|
rescue RSpec::Core::Pending::SkipDeclaredInExample => ex
|
81
|
-
for_filtered_examples(reporter)
|
81
|
+
for_filtered_examples(reporter) do |example|
|
82
|
+
if Abq.target_test_case.is_example?(example)
|
83
|
+
example.skip_with_exception(reporter, ex)
|
84
|
+
Abq.fetch_next_example
|
85
|
+
end
|
86
|
+
end
|
82
87
|
true
|
83
88
|
rescue RSpec::Support::AllExceptionsExceptOnesWeMustNotRescue => ex
|
84
89
|
# If an exception reaches here, that means we must fail the entire
|
data/lib/rspec/abq/formatter.rb
CHANGED
@@ -28,28 +28,33 @@ module RSpec
|
|
28
28
|
def self.abq_result(example)
|
29
29
|
execution_result = example.execution_result
|
30
30
|
tags, meta = Manifest.extract_metadata_and_tags(example.metadata)
|
31
|
-
{
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
lineage: RSpec::Core::Metadata.ascend(example.metadata).map { |meta| meta[:description] }.reverse
|
51
|
-
}
|
31
|
+
test_result = {
|
32
|
+
status: status(example),
|
33
|
+
id: example.id,
|
34
|
+
display_name: example.metadata[:full_description],
|
35
|
+
output: if execution_result.exception
|
36
|
+
RSpec::Core::Formatters::ExceptionPresenter
|
37
|
+
.new(execution_result.exception, example)
|
38
|
+
.fully_formatted(1)
|
39
|
+
end,
|
40
|
+
runtime: (execution_result.run_time * 1_000_000_000).round,
|
41
|
+
tags: tags,
|
42
|
+
meta: meta,
|
43
|
+
location: {
|
44
|
+
file: example.metadata[:file_path],
|
45
|
+
line: example.metadata[:line_number]
|
46
|
+
},
|
47
|
+
started_at: execution_result.started_at.utc.iso8601,
|
48
|
+
finished_at: execution_result.finished_at.utc.iso8601,
|
49
|
+
lineage: RSpec::Core::Metadata.ascend(example.metadata).map { |meta| meta[:description] }.reverse
|
52
50
|
}
|
51
|
+
|
52
|
+
past_rspec_retry_attempts = rspec_retry_attempts(example)
|
53
|
+
if past_rspec_retry_attempts
|
54
|
+
test_result[:past_attempts] = past_rspec_retry_attempts
|
55
|
+
end
|
56
|
+
|
57
|
+
{test_result: test_result}
|
53
58
|
end
|
54
59
|
|
55
60
|
private_class_method def self.status(example)
|
@@ -82,6 +87,27 @@ module RSpec
|
|
82
87
|
end
|
83
88
|
end
|
84
89
|
end
|
90
|
+
|
91
|
+
private_class_method def self.rspec_retry_attempts(example)
|
92
|
+
return unless defined?(RSpec::Retry)
|
93
|
+
return unless example.metadata.key?(:retry_attempts)
|
94
|
+
return unless example.metadata.key?(:retry_exceptions)
|
95
|
+
|
96
|
+
retry_attempts = example.metadata[:retry_attempts]
|
97
|
+
retry_exceptions = example.metadata[:retry_exceptions]
|
98
|
+
return unless retry_attempts > 0
|
99
|
+
|
100
|
+
retry_attempts.times.map do |attempt_index|
|
101
|
+
{
|
102
|
+
status: {type: :failure},
|
103
|
+
id: example.id,
|
104
|
+
display_name: example.metadata[:full_description],
|
105
|
+
output: retry_exceptions[attempt_index],
|
106
|
+
runtime: 0, # rspec-retry does not expose individual durations
|
107
|
+
meta: {} # rspec-retry exposes no other metadata beyond attempt and exceptions
|
108
|
+
}
|
109
|
+
end
|
110
|
+
end
|
85
111
|
end
|
86
112
|
end
|
87
113
|
end
|
data/lib/rspec/abq/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-abq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ayaz Hafiz
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-
|
12
|
+
date: 2023-02-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec-core
|
@@ -157,6 +157,20 @@ dependencies:
|
|
157
157
|
- - "~>"
|
158
158
|
- !ruby/object:Gem::Version
|
159
159
|
version: 2.2.1
|
160
|
+
- !ruby/object:Gem::Dependency
|
161
|
+
name: simplecov
|
162
|
+
requirement: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: 0.22.0
|
167
|
+
type: :development
|
168
|
+
prerelease: false
|
169
|
+
version_requirements: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - "~>"
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: 0.22.0
|
160
174
|
description: RSpec::Abq is an rspec plugin that replaces its ordering with one that
|
161
175
|
is controlled by abq. It allows for parallelization of rspec on a single machine
|
162
176
|
or across multiple workers.
|