rspec_junit_formatter 0.6.2 → 0.7.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 +17 -14
- data/lib/rspec_junit_formatter/rspec3.rb +4 -34
- data/lib/rspec_junit_formatter.rb +1 -7
- metadata +4 -11
- data/lib/rspec_junit_formatter/rspec2.rb +0 -86
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6a808950ca0ea8273d57ec14b76e0f33326f2cf473708c8809ce7f80d5daef1f
|
|
4
|
+
data.tar.gz: 724eb19bbed6395719c2791f5661a80f5ece271bf85eb44a1d864a883f06edde
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9bf5b02431be19674c48a308132008bdd93d1619a1efadd197009cd67c150984cdefc918f73209535a936f53dd3847b677c9f1c4823a181cc4e18e5f33411c27
|
|
7
|
+
data.tar.gz: db0d242d4eaf205bc38c795f2313a29306d8bdc82218940058929d215a5c7650a22406406bcdd9a585b0793cfa862f62302716f21d498270116625e991b0e871
|
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/
|
|
@@ -11,11 +11,13 @@
|
|
|
11
11
|
[circleci-junit]: https://circleci.com/docs/2.0/collect-test-data/
|
|
12
12
|
[gitlab-junit]: https://docs.gitlab.com/ee/ci/unit_test_reports.html#ruby-example
|
|
13
13
|
|
|
14
|
-
##
|
|
14
|
+
## Supported versions and legacy upgrades
|
|
15
15
|
|
|
16
|
-
**0.
|
|
16
|
+
**0.7.0 requires Ruby >= 3.3 and RSpec >= 3.13, < 4.** We support upstream-maintained stable Ruby branches, including security maintenance, and the maintained stable RSpec minor series. As of October 2026, [Ruby 3.3 is security-maintained and Ruby 3.4/4.0 are normally maintained](https://www.ruby-lang.org/en/downloads/branches/). [RSpec supports only the latest major/minor pair](https://rspec.info/blog/2024/11/introducing-the-monorepo/), currently 3.13; RSpec 4 prereleases are not supported. Future minor releases may raise these minimums when upstream maintenance ends.
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
**[0.6.2](https://rubygems.org/gems/rspec_junit_formatter/versions/0.6.2) is the final legacy-compatible release.** It retains Ruby >= 2.3 and RSpec >= 2, < 4 (except 2.12.0), including the encoding and aggregate failure fixes. See its [compatibility table](https://github.com/sj26/rspec_junit_formatter/blob/v0.6.2/README.md#tested-versus-permitted-versions) for tested combinations and limitations. It does not make end-of-life Ruby or RSpec versions maintained again.
|
|
19
|
+
|
|
20
|
+
If you must keep an older Ruby **or** an older RSpec, use:
|
|
19
21
|
|
|
20
22
|
```ruby
|
|
21
23
|
gem "rspec_junit_formatter", "0.6.2", require: false
|
|
@@ -23,6 +25,8 @@ gem "rspec_junit_formatter", "0.6.2", require: false
|
|
|
23
25
|
|
|
24
26
|
Then run `bundle update rspec_junit_formatter`. Without Bundler, use `gem install rspec_junit_formatter -v 0.6.2`. Upgrading Ruby alone is not enough if your project must keep an older RSpec.
|
|
25
27
|
|
|
28
|
+
To use 0.7.0, upgrade Ruby to a maintained version and RSpec to 3.13, remove the legacy formatter pin, and run `bundle update rspec rspec_junit_formatter`. Both Ruby and `rspec-core` requirements are recorded in the package so dependency resolution can retain 0.6.2 for older environments.
|
|
29
|
+
|
|
26
30
|
## Usage
|
|
27
31
|
|
|
28
32
|
Install the gem:
|
|
@@ -113,7 +117,7 @@ Note that this example captures all output from every example all the time, pote
|
|
|
113
117
|
|
|
114
118
|
## Development
|
|
115
119
|
|
|
116
|
-
Use Ruby 3.4 (see [`.ruby-version`](.ruby-version)) for maintenance.
|
|
120
|
+
Use Ruby 3.4 (see [`.ruby-version`](.ruby-version)) for maintenance. This selects the development Ruby; the installed gem's minimum is defined in the [gemspec](rspec_junit_formatter.gemspec).
|
|
117
121
|
|
|
118
122
|
Install the Bundler version recorded in `Gemfile.lock`, then test the locked development bundle:
|
|
119
123
|
|
|
@@ -125,30 +129,29 @@ bundle exec rake spec
|
|
|
125
129
|
|
|
126
130
|
The [development workflow](.github/workflows/development.yml) tests this bundle separately from the [compatibility workflow](.github/workflows/ci.yml). Use `bundle update --all` to refresh the development lockfile.
|
|
127
131
|
|
|
128
|
-
|
|
132
|
+
The supported RSpec series is also defined by [Appraisal][appraisal], with a separate Gemfile to test dependency resolution without the root lockfile:
|
|
129
133
|
|
|
130
134
|
```sh
|
|
131
|
-
BUNDLE_GEMFILE=gemfiles/
|
|
132
|
-
BUNDLE_GEMFILE=gemfiles/
|
|
135
|
+
BUNDLE_GEMFILE=gemfiles/rspec_3_13.gemfile bundle install
|
|
136
|
+
BUNDLE_GEMFILE=gemfiles/rspec_3_13.gemfile bundle exec rake spec
|
|
133
137
|
```
|
|
134
138
|
|
|
135
|
-
Plain `bundle exec rake` also runs
|
|
139
|
+
Plain `bundle exec rake` also runs the Appraisals outside CI.
|
|
136
140
|
|
|
137
141
|
[appraisal]: https://github.com/thoughtbot/appraisal
|
|
138
142
|
|
|
139
143
|
### Tested versus permitted versions
|
|
140
144
|
|
|
141
|
-
The [gemspec](rspec_junit_formatter.gemspec) permits Ruby >=
|
|
145
|
+
The [gemspec](rspec_junit_formatter.gemspec) permits Ruby >= 3.3 and `rspec-core` >= 3.13, < 4. These requirements allow installation; future versions are not automatically tested or supported.
|
|
142
146
|
|
|
143
147
|
The CI workflows test these combinations:
|
|
144
148
|
|
|
145
149
|
| Ruby | RSpec | Bundle |
|
|
146
150
|
| --- | --- | --- |
|
|
147
|
-
|
|
|
148
|
-
|
|
|
149
|
-
| 3.4 and 4.0 | Current 3.13, pinned by `Gemfile.lock` | Development |
|
|
151
|
+
| 3.3, 3.4 and 4.0 | 3.13, latest patch | Appraisal |
|
|
152
|
+
| 3.3, 3.4 and 4.0 | 3.13, pinned by `Gemfile.lock` | Development |
|
|
150
153
|
|
|
151
|
-
|
|
154
|
+
CI selects the latest patch of each listed Ruby branch. The locked bundle currently uses RSpec 3.13.2 and rspec-core 3.13.6. Older Ruby and RSpec combinations remain available in [0.6.2](https://github.com/sj26/rspec_junit_formatter/tree/v0.6.2), not in the current test matrix.
|
|
152
155
|
|
|
153
156
|
## Releasing
|
|
154
157
|
|
|
@@ -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)
|
|
@@ -125,19 +120,8 @@ private
|
|
|
125
120
|
|
|
126
121
|
# Completely gross hack for absolutely forcing off colorising for the
|
|
127
122
|
# duration of a block.
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
swap_rspec_configuration(:color_mode, :off, &block)
|
|
131
|
-
end
|
|
132
|
-
elsif RSpec.configuration.respond_to?(:color=)
|
|
133
|
-
def without_color(&block)
|
|
134
|
-
swap_rspec_configuration(:color, false, &block)
|
|
135
|
-
end
|
|
136
|
-
else
|
|
137
|
-
warn 'rspec_junit_formatter cannot prevent colorising due to an unexpected RSpec.configuration format'
|
|
138
|
-
def without_color
|
|
139
|
-
yield
|
|
140
|
-
end
|
|
123
|
+
def without_color(&block)
|
|
124
|
+
swap_rspec_configuration(:color_mode, :off, &block)
|
|
141
125
|
end
|
|
142
126
|
|
|
143
127
|
def stdout_for(example_notification)
|
|
@@ -149,23 +133,9 @@ private
|
|
|
149
133
|
end
|
|
150
134
|
|
|
151
135
|
def aggregate_failure?(exception)
|
|
152
|
-
#
|
|
136
|
+
# rspec-expectations is optional; the formatter only depends on rspec-core.
|
|
153
137
|
return false unless defined?(RSpec::Expectations::MultipleExpectationsNotMetError)
|
|
154
138
|
|
|
155
139
|
exception.is_a?(RSpec::Expectations::MultipleExpectationsNotMetError)
|
|
156
140
|
end
|
|
157
141
|
end
|
|
158
|
-
|
|
159
|
-
# rspec-core 3.0.x forgot to mark this as a module function which causes:
|
|
160
|
-
#
|
|
161
|
-
# NoMethodError: undefined method `wrap' for RSpec::Core::Notifications::NullColorizer:Class
|
|
162
|
-
# .../rspec-core-3.0.4/lib/rspec/core/notifications.rb:229:in `add_shared_group_line'
|
|
163
|
-
# .../rspec-core-3.0.4/lib/rspec/core/notifications.rb:157:in `message_lines'
|
|
164
|
-
#
|
|
165
|
-
if defined?(RSpec::Core::Notifications::NullColorizer) && RSpec::Core::Notifications::NullColorizer.is_a?(Class) && !RSpec::Core::Notifications::NullColorizer.respond_to?(:wrap)
|
|
166
|
-
RSpec::Core::Notifications::NullColorizer.class_eval do
|
|
167
|
-
def self.wrap(*args)
|
|
168
|
-
new.wrap(*args)
|
|
169
|
-
end
|
|
170
|
-
end
|
|
171
|
-
end
|
|
@@ -9,8 +9,6 @@ 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
|
|
|
16
14
|
def xml_dump
|
|
@@ -188,8 +186,4 @@ end
|
|
|
188
186
|
|
|
189
187
|
RspecJunitFormatter = RSpecJUnitFormatter
|
|
190
188
|
|
|
191
|
-
|
|
192
|
-
require "rspec_junit_formatter/rspec3"
|
|
193
|
-
else
|
|
194
|
-
require "rspec_junit_formatter/rspec2"
|
|
195
|
-
end
|
|
189
|
+
require "rspec_junit_formatter/rspec3"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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.7.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Samuel Cochran
|
|
@@ -15,26 +15,20 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - ">="
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: '
|
|
18
|
+
version: '3.13'
|
|
19
19
|
- - "<"
|
|
20
20
|
- !ruby/object:Gem::Version
|
|
21
21
|
version: '4'
|
|
22
|
-
- - "!="
|
|
23
|
-
- !ruby/object:Gem::Version
|
|
24
|
-
version: 2.12.0
|
|
25
22
|
type: :runtime
|
|
26
23
|
prerelease: false
|
|
27
24
|
version_requirements: !ruby/object:Gem::Requirement
|
|
28
25
|
requirements:
|
|
29
26
|
- - ">="
|
|
30
27
|
- !ruby/object:Gem::Version
|
|
31
|
-
version: '
|
|
28
|
+
version: '3.13'
|
|
32
29
|
- - "<"
|
|
33
30
|
- !ruby/object:Gem::Version
|
|
34
31
|
version: '4'
|
|
35
|
-
- - "!="
|
|
36
|
-
- !ruby/object:Gem::Version
|
|
37
|
-
version: 2.12.0
|
|
38
32
|
- !ruby/object:Gem::Dependency
|
|
39
33
|
name: bundler
|
|
40
34
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -120,7 +114,6 @@ files:
|
|
|
120
114
|
- LICENSE
|
|
121
115
|
- README.md
|
|
122
116
|
- lib/rspec_junit_formatter.rb
|
|
123
|
-
- lib/rspec_junit_formatter/rspec2.rb
|
|
124
117
|
- lib/rspec_junit_formatter/rspec3.rb
|
|
125
118
|
homepage: https://github.com/sj26/rspec_junit_formatter
|
|
126
119
|
licenses:
|
|
@@ -134,7 +127,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
134
127
|
requirements:
|
|
135
128
|
- - ">="
|
|
136
129
|
- !ruby/object:Gem::Version
|
|
137
|
-
version:
|
|
130
|
+
version: 3.3.0
|
|
138
131
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
139
132
|
requirements:
|
|
140
133
|
- - ">="
|
|
@@ -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
|