rspec_junit_formatter 0.6.0 → 0.8.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/README.md +60 -11
- data/lib/rspec_junit_formatter/rspec3.rb +17 -32
- data/lib/rspec_junit_formatter.rb +20 -10
- metadata +7 -38
- checksums.yaml.gz.sig +0 -1
- data/lib/rspec_junit_formatter/rspec2.rb +0 -86
- data.tar.gz.sig +0 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 86651a64a7f810497cc1958b49c285df2aea4d912e3ad9d2cc59a791902fef4c
|
|
4
|
+
data.tar.gz: e90928c8f44a31a0dfe16344200aabede4e9b11af848de063f4786ba05feb64f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c3620be8b07588d2acd5feaf5e9f795b1c4096dbf029875518084709dc70c057c1abf5c0deaed9beec954d0ff41dc11a4c36bfea404a735648bed11bde79c458
|
|
7
|
+
data.tar.gz: 869977b6c8a97bbf1f2ba08706249463e80260e92c84fd72f4feb0a45ae882214a29430ad4f344cfb7ed5b23373a540ee99ce4729ae7e2ad3dcf01e6cdba9d3c
|
data/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[](https://github.com/sj26/rspec_junit_formatter/actions/workflows/ci.yml?branch=main)
|
|
4
4
|
[](https://rubygems.org/gems/rspec_junit_formatter)
|
|
5
5
|
|
|
6
|
-
[RSpec][rspec]
|
|
6
|
+
[RSpec][rspec] 3 results that your CI can read. [Jenkins][jenkins-junit], [Buildkite][buildkite-junit], [CircleCI][circleci-junit], [Gitlab][gitlab-junit], and probably more, too.
|
|
7
7
|
|
|
8
8
|
[rspec]: http://rspec.info/
|
|
9
9
|
[jenkins-junit]: https://jenkins.io/doc/pipeline/steps/junit/
|
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
|
|
14
14
|
## Usage
|
|
15
15
|
|
|
16
|
+
Requires Ruby >= 3.3 and RSpec >= 3.13, < 4. For older versions, see [legacy support](#supported-versions-and-legacy-upgrades).
|
|
17
|
+
|
|
16
18
|
Install the gem:
|
|
17
19
|
|
|
18
20
|
```sh
|
|
@@ -33,7 +35,7 @@ You can use it in combination with other [formatters][rspec-formatters], too:
|
|
|
33
35
|
rspec --format progress --format RspecJunitFormatter --out rspec.xml
|
|
34
36
|
```
|
|
35
37
|
|
|
36
|
-
[rspec-formatters]: https://
|
|
38
|
+
[rspec-formatters]: https://rspec.info/features/3-12/rspec-core/formatters/
|
|
37
39
|
|
|
38
40
|
### Using in your project with Bundler
|
|
39
41
|
|
|
@@ -42,7 +44,7 @@ Add it to your Gemfile if you're using [Bundler][bundler]. Put it in the same gr
|
|
|
42
44
|
```ruby
|
|
43
45
|
group :test do
|
|
44
46
|
gem "rspec"
|
|
45
|
-
gem "rspec_junit_formatter"
|
|
47
|
+
gem "rspec_junit_formatter", require: false
|
|
46
48
|
end
|
|
47
49
|
```
|
|
48
50
|
|
|
@@ -53,7 +55,7 @@ Put the same arguments as the commands above in [your `.rspec`][rspec-file]:
|
|
|
53
55
|
--out rspec.xml
|
|
54
56
|
```
|
|
55
57
|
[bundler]: https://bundler.io
|
|
56
|
-
[rspec-file]: https://
|
|
58
|
+
[rspec-file]: https://rspec.info/features/3-12/rspec-core/configuration/read-options-from-file/
|
|
57
59
|
|
|
58
60
|
### Parallel tests
|
|
59
61
|
|
|
@@ -64,7 +66,47 @@ For use with `parallel_tests`, add `$TEST_ENV_NUMBER` in the output file option
|
|
|
64
66
|
--out tmp/rspec<%= ENV["TEST_ENV_NUMBER"] %>.xml
|
|
65
67
|
```
|
|
66
68
|
|
|
67
|
-
The formatter
|
|
69
|
+
The formatter appends `$TEST_ENV_NUMBER` to the test suite name within the XML, too.
|
|
70
|
+
An explicitly set value always wins, including the empty string that `parallel_tests`
|
|
71
|
+
uses for its first worker: `TEST_ENV_NUMBER=""` keeps the name `rspec`.
|
|
72
|
+
|
|
73
|
+
When `TEST_ENV_NUMBER` is **unset**, the formatter uses the first non-empty value
|
|
74
|
+
from this table, in order:
|
|
75
|
+
|
|
76
|
+
| Variable | Provider | Native first index |
|
|
77
|
+
| --- | --- | --- |
|
|
78
|
+
| `CI_NODE_INDEX` | [GitLab](https://docs.gitlab.com/ci/variables/predefined_variables/), or a user-supplied CI label | `1` on GitLab |
|
|
79
|
+
| `CIRCLE_NODE_INDEX` | [CircleCI](https://circleci.com/docs/reference/variables/#built-in-environment-variables) | `0` |
|
|
80
|
+
| `SEMAPHORE_JOB_INDEX` | [Semaphore](https://docs.semaphore.io/reference/env-vars#job-index) | `1` |
|
|
81
|
+
| `BUILDKITE_PARALLEL_JOB` | [Buildkite](https://buildkite.com/docs/pipelines/configure/environment-variables#BUILDKITE_PARALLEL_JOB) | `0` |
|
|
82
|
+
| `BITBUCKET_PARALLEL_STEP` | [Bitbucket Pipelines](https://support.atlassian.com/bitbucket-cloud/docs/parallel-step-options/) | `0` |
|
|
83
|
+
|
|
84
|
+
Values are labels, not test-sharding offsets: they are XML-escaped but otherwise
|
|
85
|
+
unchanged. For example, GitLab's `CI_NODE_INDEX=1` produces `rspec1`, while
|
|
86
|
+
Buildkite's `BUILDKITE_PARALLEL_JOB=0` produces `rspec0`. There is no index
|
|
87
|
+
conversion based on `GITLAB_CI`, and a custom `CI_NODE_INDEX` takes precedence over
|
|
88
|
+
the other CI variables. If all these values are empty or unset, the name stays
|
|
89
|
+
`rspec`; no default `0` is appended.
|
|
90
|
+
|
|
91
|
+
The old `SEMAPHORE_CURRENT_THREAD` and `SNAP_WORKER_INDEX` variables are not
|
|
92
|
+
detected: [Semaphore Classic was retired in 2023](https://semaphore.io/blog/semaphore-classic-deprecation)
|
|
93
|
+
and [Snap CI in 2017](https://github.com/snap-ci/snap-ci-blog-content/blob/master/posts/2017-02-06-2017-02-06-snap-announcement.md).
|
|
94
|
+
Other runners can set `TEST_ENV_NUMBER` explicitly.
|
|
95
|
+
|
|
96
|
+
This changes **only the XML suite name**, not the output filename. Continue to
|
|
97
|
+
choose distinct `--out` paths for processes sharing a filesystem. CI indexes are
|
|
98
|
+
unique only within their parallel job group, not across steps, builds, or nested
|
|
99
|
+
`parallel_tests` workers. To combine those reports, set an explicit label that
|
|
100
|
+
includes each relevant dimension, and use it in the filename too. For example,
|
|
101
|
+
inside each `parallel_tests` worker on Buildkite:
|
|
102
|
+
|
|
103
|
+
```sh
|
|
104
|
+
export TEST_ENV_NUMBER="-${BUILDKITE_STEP_KEY}-${BUILDKITE_PARALLEL_JOB}-${TEST_ENV_NUMBER}"
|
|
105
|
+
bundle exec rspec --format RspecJunitFormatter --out "tmp/rspec${TEST_ENV_NUMBER}.xml"
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Use distinct Buildkite step keys for this example; add a build identifier too if
|
|
109
|
+
you combine reports across builds.
|
|
68
110
|
|
|
69
111
|
### Capturing output
|
|
70
112
|
|
|
@@ -90,23 +132,30 @@ RSpec.configure do |config|
|
|
|
90
132
|
end
|
|
91
133
|
```
|
|
92
134
|
|
|
93
|
-
Note that this example captures all output from every example all the time, potentially interfering with local debugging. You might like to restrict this to only on CI, or by using [rspec filters](https://
|
|
135
|
+
Note that this example captures all output from every example all the time, potentially interfering with local debugging. You might like to restrict this to only on CI, or by using [rspec filters](https://rspec.info/features/3-12/rspec-core/hooks/filtering/).
|
|
94
136
|
|
|
95
137
|
## Caveats
|
|
96
138
|
|
|
97
139
|
* XML can only represent a [limited subset of characters][xml-charsets] which excludes null bytes and most control characters. This gem will use character entities where possible and fall back to replacing invalid characters with Ruby-like escape codes otherwise. For example, the null byte becomes `\0`.
|
|
140
|
+
* When converting report text to UTF-8 for XML output, invalid byte sequences and characters with no UTF-8 conversion are replaced with `�` (U+FFFD REPLACEMENT CHARACTER). The formatter uses each string's declared encoding; it does not guess the encoding of binary data.
|
|
98
141
|
|
|
99
142
|
[xml-charsets]: https://www.w3.org/TR/xml/#charsets
|
|
100
143
|
|
|
101
|
-
##
|
|
144
|
+
## Supported versions and legacy upgrades
|
|
102
145
|
|
|
103
|
-
|
|
146
|
+
We support [maintained Ruby versions](https://www.ruby-lang.org/en/downloads/branches/), including security maintenance, and [the current stable RSpec series](https://rspec.info/blog/2024/11/introducing-the-monorepo/). Minor releases may raise the minimum versions when upstream support ends.
|
|
147
|
+
|
|
148
|
+
For Ruby < 3.3 or RSpec < 3.13, use [0.6.2](https://rubygems.org/gems/rspec_junit_formatter/versions/0.6.2), the final legacy release:
|
|
149
|
+
|
|
150
|
+
```ruby
|
|
151
|
+
gem "rspec_junit_formatter", "0.6.2", require: false
|
|
152
|
+
```
|
|
104
153
|
|
|
105
|
-
|
|
154
|
+
Run `bundle update rspec_junit_formatter`, or install without Bundler using `gem install rspec_junit_formatter -v 0.6.2`. This release permits Ruby >= 2.3 and RSpec >= 2, < 4, except 2.12.0; see its [tested combinations](https://github.com/sj26/rspec_junit_formatter/blob/v0.6.2/README.md#tested-versus-permitted-versions).
|
|
106
155
|
|
|
107
|
-
##
|
|
156
|
+
## Contributing
|
|
108
157
|
|
|
109
|
-
|
|
158
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for development, testing and release instructions.
|
|
110
159
|
|
|
111
160
|
## License
|
|
112
161
|
|
|
@@ -46,12 +46,7 @@ private
|
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
def error_count
|
|
49
|
-
|
|
50
|
-
if @summary_notification.respond_to?(:errors_outside_of_examples_count)
|
|
51
|
-
@summary_notification.errors_outside_of_examples_count
|
|
52
|
-
else
|
|
53
|
-
0
|
|
54
|
-
end
|
|
49
|
+
@summary_notification.errors_outside_of_examples_count
|
|
55
50
|
end
|
|
56
51
|
|
|
57
52
|
def result_of(notification)
|
|
@@ -88,7 +83,15 @@ private
|
|
|
88
83
|
end
|
|
89
84
|
|
|
90
85
|
def failure_for(notification)
|
|
91
|
-
|
|
86
|
+
exception = exception_for(notification)
|
|
87
|
+
|
|
88
|
+
details = if aggregate_failure?(exception)
|
|
89
|
+
strip_diff_colors(exception.message)
|
|
90
|
+
else
|
|
91
|
+
strip_diff_colors(notification.message_lines.join("\n")) << "\n" << notification.formatted_backtrace.join("\n")
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
details.gsub(/ +$/, '')
|
|
92
95
|
end
|
|
93
96
|
|
|
94
97
|
def exception_for(notification)
|
|
@@ -119,19 +122,8 @@ private
|
|
|
119
122
|
|
|
120
123
|
# Completely gross hack for absolutely forcing off colorising for the
|
|
121
124
|
# duration of a block.
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
swap_rspec_configuration(:color_mode, :off, &block)
|
|
125
|
-
end
|
|
126
|
-
elsif RSpec.configuration.respond_to?(:color=)
|
|
127
|
-
def without_color(&block)
|
|
128
|
-
swap_rspec_configuration(:color, false, &block)
|
|
129
|
-
end
|
|
130
|
-
else
|
|
131
|
-
warn 'rspec_junit_formatter cannot prevent colorising due to an unexpected RSpec.configuration format'
|
|
132
|
-
def without_color
|
|
133
|
-
yield
|
|
134
|
-
end
|
|
125
|
+
def without_color(&block)
|
|
126
|
+
swap_rspec_configuration(:color_mode, :off, &block)
|
|
135
127
|
end
|
|
136
128
|
|
|
137
129
|
def stdout_for(example_notification)
|
|
@@ -141,18 +133,11 @@ private
|
|
|
141
133
|
def stderr_for(example_notification)
|
|
142
134
|
example_notification.example.metadata[:stderr]
|
|
143
135
|
end
|
|
144
|
-
end
|
|
145
136
|
|
|
146
|
-
|
|
147
|
-
#
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
#
|
|
152
|
-
if defined?(RSpec::Core::Notifications::NullColorizer) && RSpec::Core::Notifications::NullColorizer.is_a?(Class) && !RSpec::Core::Notifications::NullColorizer.respond_to?(:wrap)
|
|
153
|
-
RSpec::Core::Notifications::NullColorizer.class_eval do
|
|
154
|
-
def self.wrap(*args)
|
|
155
|
-
new.wrap(*args)
|
|
156
|
-
end
|
|
137
|
+
def aggregate_failure?(exception)
|
|
138
|
+
# rspec-expectations is optional; the formatter only depends on rspec-core.
|
|
139
|
+
return false unless defined?(RSpec::Expectations::MultipleExpectationsNotMetError)
|
|
140
|
+
|
|
141
|
+
exception.is_a?(RSpec::Expectations::MultipleExpectationsNotMetError)
|
|
157
142
|
end
|
|
158
143
|
end
|
|
@@ -9,14 +9,22 @@ require "rspec/core/formatters/base_formatter"
|
|
|
9
9
|
# Dumps rspec results as a JUnit XML file.
|
|
10
10
|
# Based on XML schema: http://windyroad.org/dl/Open%20Source/JUnit.xsd
|
|
11
11
|
class RSpecJUnitFormatter < RSpec::Core::Formatters::BaseFormatter
|
|
12
|
-
# rspec 2 and 3 implements are in separate files.
|
|
13
|
-
|
|
14
12
|
private
|
|
15
13
|
|
|
14
|
+
def suite_name
|
|
15
|
+
# parallel_tests deliberately uses an empty label for its first worker.
|
|
16
|
+
suffix = ENV.fetch("TEST_ENV_NUMBER") do
|
|
17
|
+
%w[CI_NODE_INDEX CIRCLE_NODE_INDEX SEMAPHORE_JOB_INDEX
|
|
18
|
+
BUILDKITE_PARALLEL_JOB BITBUCKET_PARALLEL_STEP].map { |name| ENV[name] }.
|
|
19
|
+
find { |value| value && !value.empty? }
|
|
20
|
+
end
|
|
21
|
+
"rspec#{suffix}"
|
|
22
|
+
end
|
|
23
|
+
|
|
16
24
|
def xml_dump
|
|
17
25
|
output << %{<?xml version="1.0" encoding="UTF-8"?>\n}
|
|
18
26
|
output << %{<testsuite}
|
|
19
|
-
output << %{ name="
|
|
27
|
+
output << %{ name="#{escape(suite_name)}"}
|
|
20
28
|
output << %{ tests="#{example_count}"}
|
|
21
29
|
output << %{ skipped="#{pending_count}"}
|
|
22
30
|
output << %{ failures="#{failure_count}"}
|
|
@@ -164,9 +172,13 @@ private
|
|
|
164
172
|
?>.freeze => ">".freeze,
|
|
165
173
|
).freeze
|
|
166
174
|
|
|
175
|
+
def utf8(text)
|
|
176
|
+
text.to_s.encode(Encoding::UTF_8, invalid: :replace, undef: :replace, replace: "\uFFFD")
|
|
177
|
+
end
|
|
178
|
+
|
|
167
179
|
def escape(text)
|
|
168
180
|
# Make sure it's utf-8, replace illegal characters with ruby-like escapes, and replace special and discouraged characters with entities
|
|
169
|
-
text
|
|
181
|
+
utf8(text).gsub(ILLEGAL_REGEXP, ILLEGAL_REPLACEMENT).gsub(DISCOURAGED_REGEXP, DISCOURAGED_REPLACEMENTS)
|
|
170
182
|
end
|
|
171
183
|
|
|
172
184
|
STRIP_DIFF_COLORS_BLOCK_REGEXP = /^ ( [ ]* ) Diff: (?: \e\[ 0 m )? (?: \n \1 \e\[ \d+ (?: ; \d+ )* m .* )* /x
|
|
@@ -182,14 +194,12 @@ private
|
|
|
182
194
|
# We also only want to target the diff hunks because the failure message
|
|
183
195
|
# itself might legitimately contain ansi escape codes.
|
|
184
196
|
#
|
|
185
|
-
|
|
197
|
+
# Transcode before matching: the original message may be invalid or use an
|
|
198
|
+
# encoding incompatible with the ASCII regexp. Leave XML escaping until later.
|
|
199
|
+
utf8(string).sub(STRIP_DIFF_COLORS_BLOCK_REGEXP) { |match| match.gsub(STRIP_DIFF_COLORS_CODES_REGEXP, "".freeze) }
|
|
186
200
|
end
|
|
187
201
|
end
|
|
188
202
|
|
|
189
203
|
RspecJunitFormatter = RSpecJUnitFormatter
|
|
190
204
|
|
|
191
|
-
|
|
192
|
-
require "rspec_junit_formatter/rspec3"
|
|
193
|
-
else
|
|
194
|
-
require "rspec_junit_formatter/rspec2"
|
|
195
|
-
end
|
|
205
|
+
require "rspec_junit_formatter/rspec3"
|
metadata
CHANGED
|
@@ -1,35 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rspec_junit_formatter
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.8.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Samuel Cochran
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
|
-
cert_chain:
|
|
11
|
-
-
|
|
12
|
-
-----BEGIN CERTIFICATE-----
|
|
13
|
-
MIIDXDCCAkSgAwIBAgIBATANBgkqhkiG9w0BAQsFADA6MQ0wCwYDVQQDDARzajI2
|
|
14
|
-
MRQwEgYKCZImiZPyLGQBGRYEc2oyNjETMBEGCgmSJomT8ixkARkWA2NvbTAeFw0y
|
|
15
|
-
MjA3MDQwMDQwNDZaFw0yMzA3MDQwMDQwNDZaMDoxDTALBgNVBAMMBHNqMjYxFDAS
|
|
16
|
-
BgoJkiaJk/IsZAEZFgRzajI2MRMwEQYKCZImiZPyLGQBGRYDY29tMIIBIjANBgkq
|
|
17
|
-
hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsr60Eo/ttCk8GMTMFiPr3GoYMIMFvLak
|
|
18
|
-
xSmTk9YGCB6UiEePB4THSSA5w6IPyeaCF/nWkDp3/BAam0eZMWG1IzYQB23TqIM0
|
|
19
|
-
1xzcNRvFsn0aQoQ00k+sj+G83j3T5OOV5OZIlu8xAChMkQmiPd1NXc6uFv+Iacz7
|
|
20
|
-
kj+CMsI9YUFdNoU09QY0b+u+Rb6wDYdpyvN60YC30h0h1MeYbvYZJx/iZK4XY5zu
|
|
21
|
-
4O/FL2ChjL2CPCpLZW55ShYyrzphWJwLOJe+FJ/ZBl6YXwrzQM9HKnt4titSNvyU
|
|
22
|
-
KzE3L63A3PZvExzLrN9u09kuWLLJfXB2sGOlw3n9t72rJiuBr3/OQQIDAQABo20w
|
|
23
|
-
azAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQU99dfRjEKFyczTeIz
|
|
24
|
-
m3ZsDWrNC80wGAYDVR0RBBEwD4ENc2oyNkBzajI2LmNvbTAYBgNVHRIEETAPgQ1z
|
|
25
|
-
ajI2QHNqMjYuY29tMA0GCSqGSIb3DQEBCwUAA4IBAQCsa7k3TABBcyXotr3yCq6f
|
|
26
|
-
xsgbMG9FR71c4wRgVNQi9O3jN64fQBbxo//BQlHfPCjs1CeU4es9xdQFfhqXAPXG
|
|
27
|
-
P7mK3+qd5jObjh6l3/rDKrTXNS+P+YO/1frlZ6xPjCA8XgGc4y0rhAjZnVBDV6t1
|
|
28
|
-
kmdtEmue1s1OxaMakr78XRZDxEuAeLM5fg8MYnlOFygEcAH6lZkTjXavY7s9MXRB
|
|
29
|
-
AAMioxgB6J5QhXQ42OSWIzwHZIbSv3DV9Lf5sde50HIW5f9u5jn29TUGDhSWYKkh
|
|
30
|
-
LDvy9dfwMMOdIZi75Q8SBBib84AuwhMHIlUv9FcHhh3dXsDDYkrVrpUAwCsG6yCm
|
|
31
|
-
-----END CERTIFICATE-----
|
|
32
|
-
date: 2022-09-29 00:00:00.000000000 Z
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 2026-10-21 00:00:00.000000000 Z
|
|
33
11
|
dependencies:
|
|
34
12
|
- !ruby/object:Gem::Dependency
|
|
35
13
|
name: rspec-core
|
|
@@ -37,26 +15,20 @@ dependencies:
|
|
|
37
15
|
requirements:
|
|
38
16
|
- - ">="
|
|
39
17
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: '
|
|
18
|
+
version: '3.13'
|
|
41
19
|
- - "<"
|
|
42
20
|
- !ruby/object:Gem::Version
|
|
43
21
|
version: '4'
|
|
44
|
-
- - "!="
|
|
45
|
-
- !ruby/object:Gem::Version
|
|
46
|
-
version: 2.12.0
|
|
47
22
|
type: :runtime
|
|
48
23
|
prerelease: false
|
|
49
24
|
version_requirements: !ruby/object:Gem::Requirement
|
|
50
25
|
requirements:
|
|
51
26
|
- - ">="
|
|
52
27
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: '
|
|
28
|
+
version: '3.13'
|
|
54
29
|
- - "<"
|
|
55
30
|
- !ruby/object:Gem::Version
|
|
56
31
|
version: '4'
|
|
57
|
-
- - "!="
|
|
58
|
-
- !ruby/object:Gem::Version
|
|
59
|
-
version: 2.12.0
|
|
60
32
|
- !ruby/object:Gem::Dependency
|
|
61
33
|
name: bundler
|
|
62
34
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -142,14 +114,12 @@ files:
|
|
|
142
114
|
- LICENSE
|
|
143
115
|
- README.md
|
|
144
116
|
- lib/rspec_junit_formatter.rb
|
|
145
|
-
- lib/rspec_junit_formatter/rspec2.rb
|
|
146
117
|
- lib/rspec_junit_formatter/rspec3.rb
|
|
147
118
|
homepage: https://github.com/sj26/rspec_junit_formatter
|
|
148
119
|
licenses:
|
|
149
120
|
- MIT
|
|
150
121
|
metadata:
|
|
151
122
|
changelog_uri: https://github.com/sj26/rspec_junit_formatter/blob/HEAD/CHANGELOG.md
|
|
152
|
-
post_install_message:
|
|
153
123
|
rdoc_options: []
|
|
154
124
|
require_paths:
|
|
155
125
|
- lib
|
|
@@ -157,15 +127,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
157
127
|
requirements:
|
|
158
128
|
- - ">="
|
|
159
129
|
- !ruby/object:Gem::Version
|
|
160
|
-
version:
|
|
130
|
+
version: 3.3.0
|
|
161
131
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
162
132
|
requirements:
|
|
163
133
|
- - ">="
|
|
164
134
|
- !ruby/object:Gem::Version
|
|
165
135
|
version: 2.0.0
|
|
166
136
|
requirements: []
|
|
167
|
-
rubygems_version: 3.
|
|
168
|
-
signing_key:
|
|
137
|
+
rubygems_version: 3.6.9
|
|
169
138
|
specification_version: 4
|
|
170
139
|
summary: RSpec JUnit XML formatter
|
|
171
140
|
test_files: []
|
checksums.yaml.gz.sig
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
��[h��bJ��9��$P�6��-�@V
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
class RSpecJUnitFormatter < RSpec::Core::Formatters::BaseFormatter
|
|
4
|
-
attr_reader :started
|
|
5
|
-
|
|
6
|
-
def start(example_count)
|
|
7
|
-
@started = Time.now
|
|
8
|
-
super
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
def dump_summary(duration, example_count, failure_count, pending_count)
|
|
12
|
-
super
|
|
13
|
-
xml_dump
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
private
|
|
17
|
-
|
|
18
|
-
def result_of(example)
|
|
19
|
-
example.execution_result[:status].to_sym
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def example_group_file_path_for(example)
|
|
23
|
-
meta = example.metadata
|
|
24
|
-
while meta[:example_group]
|
|
25
|
-
meta = meta[:example_group]
|
|
26
|
-
end
|
|
27
|
-
meta[:file_path]
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def classname_for(example)
|
|
31
|
-
fp = example_group_file_path_for(example)
|
|
32
|
-
fp.sub(%r{\.[^/.]+\Z}, "").gsub("/", ".").gsub(/\A\.+|\.+\Z/, "")
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def duration_for(example)
|
|
36
|
-
example.execution_result[:run_time]
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def description_for(example)
|
|
40
|
-
example.full_description
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
def exception_for(example)
|
|
44
|
-
example.execution_result[:exception]
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
def failure_type_for(example)
|
|
48
|
-
exception_for(example).class.name
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
def failure_message_for(example)
|
|
52
|
-
strip_diff_colors(exception_for(example).to_s)
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
def failure_for(example)
|
|
56
|
-
exception = exception_for(example)
|
|
57
|
-
message = strip_diff_colors(exception.message)
|
|
58
|
-
backtrace = format_backtrace(exception.backtrace, example)
|
|
59
|
-
|
|
60
|
-
if shared_group = find_shared_group(example)
|
|
61
|
-
backtrace << "Shared Example Group: \"#{shared_group.metadata[:shared_group_name]}\" called from #{shared_group.metadata[:example_group][:location]}"
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
"#{message}\n#{backtrace.join("\n")}"
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
def error_count
|
|
68
|
-
0
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
def find_shared_group(example)
|
|
72
|
-
group_and_parent_groups(example).find { |group| group.metadata[:shared_group_name] }
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
def group_and_parent_groups(example)
|
|
76
|
-
example.example_group.parent_groups + [example.example_group]
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
def stdout_for(example)
|
|
80
|
-
example.metadata[:stdout]
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
def stderr_for(example)
|
|
84
|
-
example.metadata[:stderr]
|
|
85
|
-
end
|
|
86
|
-
end
|
data.tar.gz.sig
DELETED
metadata.gz.sig
DELETED
|
Binary file
|