rspec_junit_formatter 0.7.0 → 0.7.1
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 +10 -112
- data/lib/rspec_junit_formatter/rspec3.rb +3 -1
- data/lib/rspec_junit_formatter.rb +8 -2
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f8938b63b79c5d0cfd77464773645cca9a0c72b11c5d3f1fe7fc92d0279c4021
|
|
4
|
+
data.tar.gz: 9fc9a172d1292bb89a368e889f2f90165e47b087dd5c39fe7a154d9480ca3f61
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e4c83896373201abf5ec66c1cc8dc858e44eb3def5546646e2ca72d36ea2dd70cb44d42b9db2d51d094daa46b3248fd4a189edced96f1db1a2319d4f38bdfff6
|
|
7
|
+
data.tar.gz: f3619e7aaef1751d2dc433c41e2c6608e77d31483e550fa8ce47ad95352f21c7052b10fa8b447b1f00d2a21b5d883be017939f120162fb5f635238088230aeca
|
data/README.md
CHANGED
|
@@ -11,24 +11,10 @@
|
|
|
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
|
-
## Supported versions and legacy upgrades
|
|
15
|
-
|
|
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
|
-
|
|
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:
|
|
21
|
-
|
|
22
|
-
```ruby
|
|
23
|
-
gem "rspec_junit_formatter", "0.6.2", require: false
|
|
24
|
-
```
|
|
25
|
-
|
|
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.
|
|
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
|
-
|
|
30
14
|
## Usage
|
|
31
15
|
|
|
16
|
+
Requires Ruby >= 3.3 and RSpec >= 3.13, < 4. For older versions, see [legacy support](#supported-versions-and-legacy-upgrades).
|
|
17
|
+
|
|
32
18
|
Install the gem:
|
|
33
19
|
|
|
34
20
|
```sh
|
|
@@ -115,109 +101,21 @@ Note that this example captures all output from every example all the time, pote
|
|
|
115
101
|
|
|
116
102
|
[xml-charsets]: https://www.w3.org/TR/xml/#charsets
|
|
117
103
|
|
|
118
|
-
##
|
|
104
|
+
## Supported versions and legacy upgrades
|
|
119
105
|
|
|
120
|
-
|
|
106
|
+
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.
|
|
121
107
|
|
|
122
|
-
|
|
108
|
+
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:
|
|
123
109
|
|
|
124
|
-
```
|
|
125
|
-
gem
|
|
126
|
-
bundle install
|
|
127
|
-
bundle exec rake spec
|
|
110
|
+
```ruby
|
|
111
|
+
gem "rspec_junit_formatter", "0.6.2", require: false
|
|
128
112
|
```
|
|
129
113
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
The supported RSpec series is also defined by [Appraisal][appraisal], with a separate Gemfile to test dependency resolution without the root lockfile:
|
|
114
|
+
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).
|
|
133
115
|
|
|
134
|
-
|
|
135
|
-
BUNDLE_GEMFILE=gemfiles/rspec_3_13.gemfile bundle install
|
|
136
|
-
BUNDLE_GEMFILE=gemfiles/rspec_3_13.gemfile bundle exec rake spec
|
|
137
|
-
```
|
|
116
|
+
## Contributing
|
|
138
117
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
[appraisal]: https://github.com/thoughtbot/appraisal
|
|
142
|
-
|
|
143
|
-
### Tested versus permitted versions
|
|
144
|
-
|
|
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.
|
|
146
|
-
|
|
147
|
-
The CI workflows test these combinations:
|
|
148
|
-
|
|
149
|
-
| Ruby | RSpec | Bundle |
|
|
150
|
-
| --- | --- | --- |
|
|
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 |
|
|
153
|
-
|
|
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.
|
|
155
|
-
|
|
156
|
-
## Releasing
|
|
157
|
-
|
|
158
|
-
Releases use the [Release workflow](https://github.com/sj26/rspec_junit_formatter/actions/workflows/release.yml)
|
|
159
|
-
and [RubyGems trusted publishing](https://guides.rubygems.org/trusted-publishing/).
|
|
160
|
-
GitHub Actions builds **unsigned gems**: it needs no personal signing key, persistent
|
|
161
|
-
RubyGems API key, or maintainer machine. Local `bundle exec rake build`, `install`,
|
|
162
|
-
and `release` tasks remain available; local releases may retain the maintainer's
|
|
163
|
-
traditional gem signatures. Do not publish the same version through both paths.
|
|
164
|
-
|
|
165
|
-
1. Bump the gemspec version and update the changelog in a reviewed PR. Merge it
|
|
166
|
-
into `main`. Use a new stable `X.Y.Z` version; never reuse a published version.
|
|
167
|
-
2. Tag that exact commit as `vX.Y.Z` and push the tag. Record its full commit SHA
|
|
168
|
-
with `git rev-parse 'vX.Y.Z^{commit}'`. Pushing a tag alone does not publish.
|
|
169
|
-
3. Run the Release workflow **from `main`**, supplying the tag and full SHA. Leave
|
|
170
|
-
`publish` unchecked for validation only. It checks tag/version/commit agreement
|
|
171
|
-
and main ancestry, runs the compatibility and development suites at that SHA,
|
|
172
|
-
builds the gem, rejects embedded signatures, and tests a clean installation
|
|
173
|
-
outside the checkout. PRs also exercise the package build/install check, but
|
|
174
|
-
their artifacts can never be published by this workflow.
|
|
175
|
-
4. Run again with the same tag and SHA and `publish` checked. After the checks pass,
|
|
176
|
-
review the commit and package SHA-256 in the build log, then approve the
|
|
177
|
-
`release` environment deployment. Sam can approve his own run. The publish job
|
|
178
|
-
downloads that run's exact immutable artifact, uses short-lived OIDC credentials,
|
|
179
|
-
and does not check out or build project code.
|
|
180
|
-
5. The workflow verifies that RubyGems serves identical bytes before publishing a
|
|
181
|
-
GitHub release with the same gem. Check both the
|
|
182
|
-
[RubyGems version](https://rubygems.org/gems/rspec_junit_formatter/versions) and
|
|
183
|
-
[GitHub release](https://github.com/sj26/rspec_junit_formatter/releases).
|
|
184
|
-
|
|
185
|
-
### One-time configuration
|
|
186
|
-
|
|
187
|
-
The GitHub `release` environment must require approval by `sj26`, allow
|
|
188
|
-
self-approval, disable admin bypass, and allow deployments only from the `main`
|
|
189
|
-
branch. The **Immutable release tags** repository ruleset blocks updates and
|
|
190
|
-
deletion of `v*` tags, with no bypass actors. Under the existing gem's
|
|
191
|
-
**Trusted publishers** on RubyGems, configure:
|
|
192
|
-
|
|
193
|
-
| Field | Value |
|
|
194
|
-
| --- | --- |
|
|
195
|
-
| Repository owner | `sj26` |
|
|
196
|
-
| Repository name | `rspec_junit_formatter` |
|
|
197
|
-
| Workflow filename | `release.yml` |
|
|
198
|
-
| Environment | `release` |
|
|
199
|
-
|
|
200
|
-
Leave reusable-workflow repository fields blank. This workflow grants
|
|
201
|
-
`id-token: write` only to the environment-protected publish job. Do not add a
|
|
202
|
-
RubyGems API key or personal signing key to repository secrets.
|
|
203
|
-
|
|
204
|
-
### Recovery
|
|
205
|
-
|
|
206
|
-
Release runs are serialized and never auto-cancel an active publication. If a
|
|
207
|
-
push succeeds but a later step fails, **re-run failed jobs in the original run**
|
|
208
|
-
while its `release-gem` artifact is retained (30 days). This reuses the validated
|
|
209
|
-
bytes and requires environment approval again. An existing RubyGems version is
|
|
210
|
-
accepted only if its SHA-256 matches, and its downloaded bytes must also match.
|
|
211
|
-
An incomplete GitHub draft can resume; an existing asset must match byte-for-byte
|
|
212
|
-
and is never overwritten. A published GitHub release missing its gem fails closed
|
|
213
|
-
and needs manual inspection rather than silently changing a public release.
|
|
214
|
-
|
|
215
|
-
If the tag moved, a digest differs, or the original artifact expired, stop and
|
|
216
|
-
investigate. Do not delete/recreate tags, yank/re-push gems, or overwrite release
|
|
217
|
-
assets to force a retry. A fresh run rebuilds and is safe only if it reproduces
|
|
218
|
-
the same bytes; otherwise recover the original artifact or use a new version
|
|
219
|
-
through the normal review process. Validation-only runs do not test OIDC exchange
|
|
220
|
-
or publication; only a real, explicitly approved new release can prove those paths.
|
|
118
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for development, testing and release instructions.
|
|
221
119
|
|
|
222
120
|
## License
|
|
223
121
|
|
|
@@ -85,11 +85,13 @@ private
|
|
|
85
85
|
def failure_for(notification)
|
|
86
86
|
exception = exception_for(notification)
|
|
87
87
|
|
|
88
|
-
if aggregate_failure?(exception)
|
|
88
|
+
details = if aggregate_failure?(exception)
|
|
89
89
|
strip_diff_colors(exception.message)
|
|
90
90
|
else
|
|
91
91
|
strip_diff_colors(notification.message_lines.join("\n")) << "\n" << notification.formatted_backtrace.join("\n")
|
|
92
92
|
end
|
|
93
|
+
|
|
94
|
+
details.gsub(/ +$/, '')
|
|
93
95
|
end
|
|
94
96
|
|
|
95
97
|
def exception_for(notification)
|
|
@@ -162,9 +162,13 @@ private
|
|
|
162
162
|
?>.freeze => ">".freeze,
|
|
163
163
|
).freeze
|
|
164
164
|
|
|
165
|
+
def utf8(text)
|
|
166
|
+
text.to_s.encode(Encoding::UTF_8, invalid: :replace, undef: :replace, replace: "\uFFFD")
|
|
167
|
+
end
|
|
168
|
+
|
|
165
169
|
def escape(text)
|
|
166
170
|
# Make sure it's utf-8, replace illegal characters with ruby-like escapes, and replace special and discouraged characters with entities
|
|
167
|
-
text
|
|
171
|
+
utf8(text).gsub(ILLEGAL_REGEXP, ILLEGAL_REPLACEMENT).gsub(DISCOURAGED_REGEXP, DISCOURAGED_REPLACEMENTS)
|
|
168
172
|
end
|
|
169
173
|
|
|
170
174
|
STRIP_DIFF_COLORS_BLOCK_REGEXP = /^ ( [ ]* ) Diff: (?: \e\[ 0 m )? (?: \n \1 \e\[ \d+ (?: ; \d+ )* m .* )* /x
|
|
@@ -180,7 +184,9 @@ private
|
|
|
180
184
|
# We also only want to target the diff hunks because the failure message
|
|
181
185
|
# itself might legitimately contain ansi escape codes.
|
|
182
186
|
#
|
|
183
|
-
|
|
187
|
+
# Transcode before matching: the original message may be invalid or use an
|
|
188
|
+
# encoding incompatible with the ASCII regexp. Leave XML escaping until later.
|
|
189
|
+
utf8(string).sub(STRIP_DIFF_COLORS_BLOCK_REGEXP) { |match| match.gsub(STRIP_DIFF_COLORS_CODES_REGEXP, "".freeze) }
|
|
184
190
|
end
|
|
185
191
|
end
|
|
186
192
|
|