rspec-osc7501 0.1.4 → 0.2.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/ACCESSIBILITY.md +5 -5
- data/CHANGELOG.md +7 -0
- data/CONTRIBUTING.md +10 -10
- data/README.md +10 -38
- data/SECURITY.md +3 -2
- data/doc/behavior.rdoc +5 -0
- data/lib/rspec/osc7501/formatter.rb +3 -3
- data/lib/rspec/osc7501/managed.rb +1 -1
- data/lib/rspec/osc7501/version.rb +1 -1
- data/lib/rspec/osc7501/writer.rb +16 -6
- 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: dc8ed02d50f444325bceda0da3e2869c521dbb408372b396885b08785b44d745
|
|
4
|
+
data.tar.gz: fb25dbd7f8514b7158ad1df53fcbe475c5fe60a64d7abe52112a195cec6587a9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 37828c01adc781fe4db020940367a3c6cf025b5ed80ece6be88aa2569f7b2e8946f5f549f4351bcd22f8e6d87d1ff1d19285d94c708b4a7eb409d8cf95a87888
|
|
7
|
+
data.tar.gz: fea1242eeeaa665355fa4375106861b4541cee64ced98c794ae3b15cbb7afe028134502f106aea7efcc12230ddc6aeced65bb5bda0a2da2905ce3f3cade5f657
|
data/ACCESSIBILITY.md
CHANGED
|
@@ -15,12 +15,12 @@ RSPEC_OSC7501=off bundle exec rspec --format documentation --no-color
|
|
|
15
15
|
`--no-color` disables RSpec's text colors. `RSPEC_OSC7501=off` disables this
|
|
16
16
|
gem's status records, even when your RSpec configuration selects the formatter.
|
|
17
17
|
|
|
18
|
-
By default, the formatter sends no status records to
|
|
19
|
-
with `TERM=dumb`. `RSPEC_OSC7501=force` overrides those defaults.
|
|
18
|
+
By default, the formatter sends no status records to redirected streams or to
|
|
19
|
+
terminals with `TERM=dumb`. `RSPEC_OSC7501=force` overrides those defaults.
|
|
20
20
|
|
|
21
21
|
## Environments and limits
|
|
22
22
|
|
|
23
|
-
The gem
|
|
23
|
+
The gem targets MRI Ruby 2.1 or newer and RSpec Core 3.6 or newer.
|
|
24
24
|
Terminal status requires an OSC 7501-capable terminal. The formatter checks
|
|
25
25
|
for a TTY and honors `TERM=dumb` but does not detect OSC support.
|
|
26
26
|
|
|
@@ -31,6 +31,6 @@ but your screen reader may need other settings.
|
|
|
31
31
|
## Report a barrier
|
|
32
32
|
|
|
33
33
|
Open an [issue](https://github.com/cosgroveb/rspec-osc7501/issues) describing what
|
|
34
|
-
you tried
|
|
35
|
-
|
|
34
|
+
you tried and what would help. Include your terminal and assistive
|
|
35
|
+
technology versions when relevant.
|
|
36
36
|
You do not need to disclose a disability or other medical information.
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.2.0 - 2026-11-15
|
|
6
|
+
|
|
7
|
+
- Tighten repo prose and code comments ([ad3fb64](https://github.com/cosgroveb/rspec-osc7501/commit/ad3fb64399f0b72783551d8bd42eb5dfe0116e07))
|
|
8
|
+
- Restore README install group and run context ([a043720](https://github.com/cosgroveb/rspec-osc7501/commit/a043720de24775d7b76bfcc6fcbf22cab5773469))
|
|
9
|
+
- Add version policy and release script usability fixes ([26257be](https://github.com/cosgroveb/rspec-osc7501/commit/26257be86d020c8ddb855c79efdf1ad27d1a8da5))
|
|
10
|
+
- Show the current example in the terminal title \(\#20\) ([f751207](https://github.com/cosgroveb/rspec-osc7501/commit/f7512077e22b463ad068f091de2ef5512f09739b))
|
|
11
|
+
|
|
5
12
|
## 0.1.4 - 2026-11-11
|
|
6
13
|
|
|
7
14
|
- Allow newer RSpec versions and test RSpec 4 ([a3f8f5d](https://github.com/cosgroveb/rspec-osc7501/commit/a3f8f5decaf8d27328dd9dcc14536b8b8f4a35cb))
|
data/CONTRIBUTING.md
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
Follow the [code of conduct](CODE_OF_CONDUCT.md). Report vulnerabilities through
|
|
4
4
|
the private channel in [SECURITY.md](SECURITY.md).
|
|
5
5
|
|
|
6
|
-
AI-assisted contributions
|
|
7
|
-
the changes
|
|
8
|
-
|
|
9
|
-
explain your choices and address feedback.
|
|
6
|
+
I welcome AI-assisted contributions. Before requesting review, understand
|
|
7
|
+
the changes and verify the claims in the affected code and docs. Run the
|
|
8
|
+
relevant checks. State what you tested and what remains uncertain. Be prepared to
|
|
9
|
+
explain your choices and address feedback. If you use an agent to help answer
|
|
10
10
|
a reviewer, check the answer and send only what is relevant.
|
|
11
11
|
|
|
12
12
|
Use MRI Ruby 3.3 or newer for development tooling. Install actionlint 1.7.12 on your PATH, then run all checks:
|
|
@@ -46,7 +46,7 @@ passing and failing suites without loading the checkout's library.
|
|
|
46
46
|
|
|
47
47
|
## Runtime compatibility
|
|
48
48
|
|
|
49
|
-
The gem
|
|
49
|
+
The gem targets MRI Ruby 2.1 or newer and RSpec Core 3.6 or newer.
|
|
50
50
|
Use `Gemfile.compat` to test the formatter without modern lint, release or RDoc
|
|
51
51
|
dependencies. On Ruby 2.1, install Bundler 1.17.3 first. Set the RSpec version
|
|
52
52
|
before resolving dependencies:
|
|
@@ -65,8 +65,8 @@ Remove `Gemfile.compat.lock` before changing RSpec versions. Keep it out of comm
|
|
|
65
65
|
The compatibility bundle pins diff-lcs 1.3 so test dependencies install on Ruby 2.1.
|
|
66
66
|
CI checks the oldest Ruby against both RSpec endpoints, the oldest RSpec on modern
|
|
67
67
|
Ruby, and the Debian Bullseye and Bookworm version families. These jobs run the
|
|
68
|
-
formatter suite and installed-gem smoke checks.
|
|
69
|
-
|
|
68
|
+
formatter suite and installed-gem smoke checks. The main development job also
|
|
69
|
+
runs lint and documentation checks.
|
|
70
70
|
CI also checks RSpec 4.0.0.beta1 on Ruby 4.0.
|
|
71
71
|
|
|
72
72
|
Compatibility checks use available patch releases within each Ruby series.
|
|
@@ -87,7 +87,7 @@ stable version greater than the current release:
|
|
|
87
87
|
gh workflow run release.yml --ref main -f version=NEW_VERSION
|
|
88
88
|
```
|
|
89
89
|
|
|
90
|
-
The workflow captures `main
|
|
90
|
+
The workflow captures `main` and updates `VERSION`. It generates CHANGELOG bullets
|
|
91
91
|
from non-merge commit subjects since the previous release tag. It preserves
|
|
92
92
|
older changelog sections and uses the same notes for the GitHub Release.
|
|
93
93
|
Versions must use `major.minor.patch` without a `v` prefix or prerelease suffix.
|
|
@@ -95,8 +95,8 @@ A new version must exceed the current version and include new commits.
|
|
|
95
95
|
|
|
96
96
|
The full CI matrix tests the prepared release commit before the workflow pushes
|
|
97
97
|
it and its tag together. If `main` advances during testing, the workflow stops.
|
|
98
|
-
After the push, it publishes to RubyGems, then creates the GitHub Release
|
|
99
|
-
|
|
98
|
+
After the push, it publishes to RubyGems, then creates the GitHub Release
|
|
99
|
+
without waiting for approval.
|
|
100
100
|
|
|
101
101
|
If a release fails, inspect its logs and rerun the same version. If its tag
|
|
102
102
|
already exists, the workflow tests and resumes that tagged release instead of
|
data/README.md
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
# rspec-osc7501
|
|
2
2
|
|
|
3
|
-
Report RSpec suite
|
|
3
|
+
Report RSpec suite progress and results to terminals that support
|
|
4
4
|
[OSC 7501](https://www.superlogical.com/rex/docs/build/program-status).
|
|
5
|
-
Use the formatter alongside RSpec's progress or documentation formatter.
|
|
6
|
-
|
|
7
5
|
Requires MRI Ruby 2.1 or newer and `rspec-core >= 3.6`.
|
|
8
6
|
|
|
9
7
|
## Install
|
|
10
8
|
|
|
11
|
-
Add the gem to your Gemfile:
|
|
12
|
-
|
|
13
9
|
```ruby
|
|
14
10
|
group :test do
|
|
15
11
|
gem "rspec"
|
|
@@ -17,32 +13,20 @@ group :test do
|
|
|
17
13
|
end
|
|
18
14
|
```
|
|
19
15
|
|
|
20
|
-
Run
|
|
21
|
-
|
|
22
|
-
## Run
|
|
23
|
-
|
|
24
|
-
Run your specs in a terminal that supports OSC 7501:
|
|
16
|
+
## Run your specs in a terminal that supports OSC 7501:
|
|
25
17
|
|
|
26
18
|
```sh
|
|
27
19
|
bundle exec rspec --require rspec/osc7501 \
|
|
28
20
|
--format progress --format RSpec::OSC7501::Formatter
|
|
29
21
|
```
|
|
30
22
|
|
|
31
|
-
Keep `--format progress` to see RSpec's dots
|
|
32
|
-
|
|
33
|
-
status records. Requiring `rspec/osc7501` registers the formatter without selecting
|
|
34
|
-
it.
|
|
35
|
-
|
|
36
|
-
To check the emitted records without terminal support, force output through a
|
|
37
|
-
pipe:
|
|
23
|
+
Keep `--format progress` to see RSpec's dots and summary. Requiring
|
|
24
|
+
`rspec/osc7501` registers the formatter without selecting it.
|
|
38
25
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
Look for `^[]7501;` records alongside RSpec output. A normal completed run ends
|
|
45
|
-
with a `state=done` or `state=error` record.
|
|
26
|
+
Reporting also sets the terminal title. While examples run, the title is
|
|
27
|
+
`rspec › <current example>`. The title returns to `rspec` on completion,
|
|
28
|
+
failure, and interruption. Titles are sanitized and capped at 512 bytes
|
|
29
|
+
including the `rspec › ` prefix.
|
|
46
30
|
|
|
47
31
|
## Configure
|
|
48
32
|
|
|
@@ -51,22 +35,10 @@ with a `state=done` or `state=error` record.
|
|
|
51
35
|
| `RSPEC_OSC7501` | `auto` emits to a TTY unless `TERM=dumb`, `off` disables output, `force` overrides both checks | `auto` |
|
|
52
36
|
| `RSPEC_OSC7501_TITLE` | Title for the suite's status records | `RSpec` |
|
|
53
37
|
|
|
54
|
-
The formatter uses the output stream RSpec assigns, including `--out`. Default
|
|
55
|
-
mode emits nothing to redirected streams. Use one reporting RSpec process per
|
|
56
|
-
terminal. Concurrent processes overwrite the same status record.
|
|
57
|
-
|
|
58
|
-
Early stops report `idle` unless failure conditions take precedence. Termination
|
|
59
|
-
that bypasses formatter callbacks can leave the last status in place. See
|
|
60
|
-
[behavior and limits](doc/behavior.rdoc) for classification details.
|
|
61
|
-
|
|
62
38
|
## Documentation
|
|
63
39
|
|
|
64
40
|
- [Usage recipes](doc/usage.rdoc): persistent configuration and output routing.
|
|
65
|
-
- [Behavior and
|
|
66
|
-
- [Contributing](CONTRIBUTING.md)
|
|
67
|
-
- [Accessibility](ACCESSIBILITY.md): text output and reporting barriers.
|
|
68
|
-
- [Security policy](SECURITY.md): supported releases and private reporting.
|
|
69
|
-
- [Code of conduct](CODE_OF_CONDUCT.md): participation and conduct reports.
|
|
70
|
-
- [Changelog](CHANGELOG.md).
|
|
41
|
+
- [Behavior and limits](doc/behavior.rdoc): terminal states and concurrency.
|
|
42
|
+
- [Contributing](CONTRIBUTING.md), [accessibility](ACCESSIBILITY.md), [security](SECURITY.md), [code of conduct](CODE_OF_CONDUCT.md), [changelog](CHANGELOG.md)
|
|
71
43
|
|
|
72
44
|
Licensed under [Apache License 2.0](LICENSE).
|
data/SECURITY.md
CHANGED
|
@@ -11,8 +11,9 @@ Older releases do not receive security backports.
|
|
|
11
11
|
Use [GitHub private vulnerability reporting](https://github.com/cosgroveb/rspec-osc7501/security/advisories/new).
|
|
12
12
|
Do not disclose vulnerabilities in public issues or pull requests.
|
|
13
13
|
|
|
14
|
-
Include the affected gem
|
|
15
|
-
|
|
14
|
+
Include the affected gem and RSpec versions you are running. Add your Ruby
|
|
15
|
+
version, plus steps or a small example that reproduces the problem, and
|
|
16
|
+
describe the impact. Include terminal and tmux versions
|
|
16
17
|
when relevant. Remove credentials and unrelated private data from examples.
|
|
17
18
|
|
|
18
19
|
I review reports and coordinate a fix and public disclosure with the reporter.
|
data/doc/behavior.rdoc
CHANGED
|
@@ -97,6 +97,11 @@ replaces invalid encoding, and truncates on character boundaries. Decoded titles
|
|
|
97
97
|
are at most 192 bytes, decoded messages at most 2048 bytes, and frames at most
|
|
98
98
|
4096 bytes.
|
|
99
99
|
|
|
100
|
+
Each status update is preceded by an OSC 2 window title: <tt>rspec › example</tt>
|
|
101
|
+
while an example runs, the bare prefix <tt>rspec</tt> otherwise. Window titles are
|
|
102
|
+
sanitized like messages, truncated on character boundaries, and at most 512 bytes
|
|
103
|
+
including the prefix.
|
|
104
|
+
|
|
100
105
|
Before sanitization, the formatter keeps at most 288 input bytes for titles and
|
|
101
106
|
3072 for messages. This bounds sanitization work with 50% headroom for stripped
|
|
102
107
|
controls. Control-heavy input can produce shorter output. A character split by
|
|
@@ -5,7 +5,7 @@ require 'English'
|
|
|
5
5
|
module RSpec
|
|
6
6
|
# Reports RSpec suite status through OSC 7501 terminal records.
|
|
7
7
|
module OSC7501
|
|
8
|
-
# RSpec formatter for suite
|
|
8
|
+
# RSpec formatter for suite progress and final results.
|
|
9
9
|
# Select alongside an ordinary formatter to retain RSpec's text output.
|
|
10
10
|
class Formatter
|
|
11
11
|
RSpec::Core::Formatters.register self, :start, :example_started, :example_passed,
|
|
@@ -61,7 +61,7 @@ module RSpec
|
|
|
61
61
|
update
|
|
62
62
|
end
|
|
63
63
|
|
|
64
|
-
# Emits the final state
|
|
64
|
+
# Emits the final state and counts from RSpec's summary.
|
|
65
65
|
# Final output bypasses throttling and omits progress.
|
|
66
66
|
def dump_summary(notification)
|
|
67
67
|
active_exception = $ERROR_INFO
|
|
@@ -92,7 +92,7 @@ module RSpec
|
|
|
92
92
|
message += ", #{@failed} failures" if @failed > 0
|
|
93
93
|
message += ", #{@pending} pending" if @pending > 0
|
|
94
94
|
message += ": #{@current}" if @current
|
|
95
|
-
@writer.emit(state: 'working', msg: message, progress: progress)
|
|
95
|
+
@writer.emit(state: 'working', msg: message, progress: progress, window_title: @current)
|
|
96
96
|
@last_update = now
|
|
97
97
|
end
|
|
98
98
|
|
|
@@ -4,7 +4,7 @@ require_relative '../osc7501'
|
|
|
4
4
|
|
|
5
5
|
module RSpec
|
|
6
6
|
module OSC7501
|
|
7
|
-
#
|
|
7
|
+
# Installs an additive formatter when a managed child ID is present.
|
|
8
8
|
module Managed
|
|
9
9
|
# Isolate RSpec's private formatter-loader seam to this configuration.
|
|
10
10
|
module Loader # :nodoc: all
|
data/lib/rspec/osc7501/writer.rb
CHANGED
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
module RSpec
|
|
4
4
|
module OSC7501
|
|
5
5
|
class Writer # :nodoc: all
|
|
6
|
+
TITLE_BYTE_LIMIT = 512
|
|
7
|
+
TITLE_PREFIX = 'rspec'
|
|
8
|
+
|
|
6
9
|
def self.valid_id?(id)
|
|
7
10
|
id.is_a?(String) && id.ascii_only? && id.bytesize <= 128 &&
|
|
8
11
|
!!(id =~ %r{\A[A-Za-z0-9_.+-]{1,32}(?:/[A-Za-z0-9_.+-]{1,32}){0,7}\z})
|
|
@@ -15,15 +18,16 @@ module RSpec
|
|
|
15
18
|
@id = id
|
|
16
19
|
@enabled = (id.nil? || self.class.valid_id?(id)) &&
|
|
17
20
|
output_enabled?(mode)
|
|
18
|
-
@title =
|
|
21
|
+
@title = [sanitize(title, 192)].pack('m0') if @enabled
|
|
19
22
|
rescue IOError, SystemCallError
|
|
20
23
|
@enabled = false
|
|
21
24
|
end
|
|
22
25
|
|
|
23
|
-
def emit(state:, msg:, progress: nil)
|
|
26
|
+
def emit(state:, msg:, progress: nil, window_title: nil)
|
|
24
27
|
return unless @enabled
|
|
25
28
|
|
|
26
|
-
|
|
29
|
+
write_window_title(window_title)
|
|
30
|
+
fields = ['app=rspec', "title=#{@title}", "state=#{state}", "msg=#{[sanitize(msg, 2048)].pack('m0')}"]
|
|
27
31
|
fields << "id=#{@id}" if @id
|
|
28
32
|
fields << "progress=#{[[progress.to_i, 0].max, 100].min}" if state == 'working' && !progress.nil?
|
|
29
33
|
@output.write("\e]7501;#{fields.join(':')}\e\\")
|
|
@@ -34,6 +38,13 @@ module RSpec
|
|
|
34
38
|
|
|
35
39
|
private
|
|
36
40
|
|
|
41
|
+
# Compose only after sanitizing the name so binary input cannot mix encodings.
|
|
42
|
+
def write_window_title(name_input)
|
|
43
|
+
name = name_input && sanitize(name_input, TITLE_BYTE_LIMIT)
|
|
44
|
+
title = name && !name.empty? && sanitize(TITLE_PREFIX + " › #{name}", TITLE_BYTE_LIMIT)
|
|
45
|
+
@output.write("\e]2;#{title || TITLE_PREFIX}\e\\")
|
|
46
|
+
end
|
|
47
|
+
|
|
37
48
|
def output_enabled?(mode)
|
|
38
49
|
mode == 'force' || (mode == 'auto' && automatic_output?)
|
|
39
50
|
end
|
|
@@ -42,15 +53,14 @@ module RSpec
|
|
|
42
53
|
ENV['TERM'] != 'dumb' && @output.respond_to?(:tty?) && @output.tty?
|
|
43
54
|
end
|
|
44
55
|
|
|
45
|
-
def
|
|
56
|
+
def sanitize(text, byte_limit)
|
|
46
57
|
input = text.to_s.byteslice(0, sanitization_byte_limit(byte_limit))
|
|
47
58
|
clean = input.encode('UTF-8', invalid: :replace, undef: :replace).gsub(/[\u0000-\u001F\u007F-\u009F]/, '')
|
|
48
59
|
bytes = 0
|
|
49
|
-
|
|
60
|
+
clean.each_char.take_while do |char|
|
|
50
61
|
bytes += char.bytesize
|
|
51
62
|
bytes <= byte_limit
|
|
52
63
|
end.join
|
|
53
|
-
[bounded].pack('m0')
|
|
54
64
|
end
|
|
55
65
|
|
|
56
66
|
# Bound sanitization work with 50% headroom for stripped controls.
|