rspec-osc7501 0.1.3 → 0.1.4
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 +1 -1
- data/CHANGELOG.md +6 -0
- data/CONTRIBUTING.md +5 -4
- data/README.md +1 -1
- data/doc/behavior.rdoc +23 -5
- data/doc/usage.rdoc +16 -0
- data/lib/rspec/osc7501/formatter.rb +1 -1
- data/lib/rspec/osc7501/managed.rb +31 -0
- data/lib/rspec/osc7501/version.rb +1 -1
- data/lib/rspec/osc7501/writer.rb +14 -2
- metadata +2 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 79ad566e60d534a4c2ed14bbdf177c356948b8c55424d8be4463121b7bd6c82f
|
|
4
|
+
data.tar.gz: 588d8086263c7e701cb3328117f76aa07fdaa3a3d81504b18d9e1ae81fac39bc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 88adf7e04930b2659e90dd1a46dbb81234372ee4b1b1afc4bad96053e5e7cf0a322de239b6af34a9294472c4ff536733fe4ffa3c7d2d7e0e51d323ca022ce3d3
|
|
7
|
+
data.tar.gz: 5d98d13922f3f2a755bffc6a9bf0fb028e4877e33c8b7693ba0b92f2f703efe8207059dc2bbe1726efcd0d5efa4b8c1e8443a73c5e768bb0dd57c652087d58bd
|
data/ACCESSIBILITY.md
CHANGED
|
@@ -20,7 +20,7 @@ with `TERM=dumb`. `RSPEC_OSC7501=force` overrides those defaults.
|
|
|
20
20
|
|
|
21
21
|
## Environments and limits
|
|
22
22
|
|
|
23
|
-
The gem
|
|
23
|
+
The gem requires 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
|
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.1.4 - 2026-11-11
|
|
6
|
+
|
|
7
|
+
- Allow newer RSpec versions and test RSpec 4 ([a3f8f5d](https://github.com/cosgroveb/rspec-osc7501/commit/a3f8f5decaf8d27328dd9dcc14536b8b8f4a35cb))
|
|
8
|
+
- Configure local Ruby and OSC spec reporting ([495f6be](https://github.com/cosgroveb/rspec-osc7501/commit/495f6be57799835da5ceddddd23e44a1cee4ca9d))
|
|
9
|
+
- Add managed RSpec child reporting \(\#13\) ([7e6d4c1](https://github.com/cosgroveb/rspec-osc7501/commit/7e6d4c15d8e210da0ff9cf90ecf05248d1863b5e))
|
|
10
|
+
|
|
5
11
|
## 0.1.3 - 2026-11-10
|
|
6
12
|
|
|
7
13
|
- Support Ruby 2.1 and RSpec 3.6 ([5afb73d](https://github.com/cosgroveb/rspec-osc7501/commit/5afb73d1ededebcafbcb81096e6bb024f791a46c))
|
data/CONTRIBUTING.md
CHANGED
|
@@ -29,7 +29,7 @@ defined order because their interrupt and fail-fast cases depend on sequence.
|
|
|
29
29
|
|
|
30
30
|
Keep runtime dependencies limited to `rspec-core`. Cover formatter behavior with
|
|
31
31
|
specs and lifecycle changes with real RSpec subprocesses. Check RSpec 3.6 through
|
|
32
|
-
3.13 when changing early-stop detection.
|
|
32
|
+
3.13 and the RSpec 4 preview when changing early-stop detection.
|
|
33
33
|
|
|
34
34
|
Build the gem and documentation:
|
|
35
35
|
|
|
@@ -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 requires 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:
|
|
@@ -67,11 +67,12 @@ CI checks the oldest Ruby against both RSpec endpoints, the oldest RSpec on mode
|
|
|
67
67
|
Ruby, and the Debian Bullseye and Bookworm version families. These jobs run the
|
|
68
68
|
formatter suite and installed-gem smoke checks. Modern jobs also test release
|
|
69
69
|
automation, lint and documentation.
|
|
70
|
+
CI also checks RSpec 4.0.0.beta1 on Ruby 4.0.
|
|
70
71
|
|
|
71
72
|
Compatibility checks use available patch releases within each Ruby series.
|
|
72
73
|
Supporting an older runtime does not extend its upstream security maintenance.
|
|
73
|
-
Unset `BUNDLE_GEMFILE`, `RSPEC_MINOR` and `
|
|
74
|
-
the modern development bundle.
|
|
74
|
+
Unset `BUNDLE_GEMFILE`, `RSPEC_MINOR`, `RSPEC_CORE_VERSION` and `RSPEC_VERSION`
|
|
75
|
+
before returning to the modern development bundle.
|
|
75
76
|
|
|
76
77
|
Update usage or behavior documentation for user-visible changes. Write commit
|
|
77
78
|
subjects that describe the change, because release notes use those subjects.
|
data/README.md
CHANGED
|
@@ -4,7 +4,7 @@ Report RSpec suite activity, progress and results to terminals that support
|
|
|
4
4
|
[OSC 7501](https://www.superlogical.com/rex/docs/build/program-status).
|
|
5
5
|
Use the formatter alongside RSpec's progress or documentation formatter.
|
|
6
6
|
|
|
7
|
-
Requires MRI Ruby 2.1 or newer and `rspec-core >= 3.6
|
|
7
|
+
Requires MRI Ruby 2.1 or newer and `rspec-core >= 3.6`.
|
|
8
8
|
|
|
9
9
|
## Install
|
|
10
10
|
|
data/doc/behavior.rdoc
CHANGED
|
@@ -22,8 +22,25 @@ Settings apply when RSpec constructs the formatter.
|
|
|
22
22
|
|
|
23
23
|
Other mode values raise ArgumentError. A supporting terminal determines how to
|
|
24
24
|
display status. The formatter sends no capability query and reads no stdin.
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
Without a child ID, concurrent processes replace the same root status record.
|
|
26
|
+
Managed invocations use separate named records without worker aggregation.
|
|
27
|
+
|
|
28
|
+
== Managed child context
|
|
29
|
+
|
|
30
|
+
<tt>RSPEC_OSC7501_ID</tt> selects a named record. Omit it for standalone root
|
|
31
|
+
behavior. IDs contain one to eight slash-separated ASCII segments using
|
|
32
|
+
<tt>A-Z a-z 0-9 _ . + -</tt>. Each segment allows 1 to 32 bytes and the whole ID
|
|
33
|
+
allows at most 128 bytes. An empty or invalid ID silences OSC output rather than
|
|
34
|
+
writing to the root record. It leaves ordinary output and exit status unchanged.
|
|
35
|
+
|
|
36
|
+
The optional <tt>rspec/osc7501/managed</tt> preload selects OSC only with valid
|
|
37
|
+
context and without <tt>RSPEC_OSC7501=off</tt>. It waits for RSpec's configured
|
|
38
|
+
formatters, preserves its default formatter, and adds OSC only when none exists.
|
|
39
|
+
An existing OSC selection keeps its output stream. The preload isolates RSpec's
|
|
40
|
+
private formatter-loader seam to the configured instance.
|
|
41
|
+
|
|
42
|
+
Managed child records remain after completion. Parent tools report their own
|
|
43
|
+
outcomes. A successful suite summary does not establish later process success.
|
|
27
44
|
|
|
28
45
|
== Progress and outcomes
|
|
29
46
|
|
|
@@ -70,7 +87,7 @@ exit hook.
|
|
|
70
87
|
|
|
71
88
|
== Wire format
|
|
72
89
|
|
|
73
|
-
Each frame addresses the root record, repeats <tt>app=rspec</tt>, title, and
|
|
90
|
+
Each frame addresses the root record unless a valid child ID is supplied, repeats <tt>app=rspec</tt>, title, and
|
|
74
91
|
message, and ends with ST (ESC followed by a backslash). The formatter writes each
|
|
75
92
|
frame in one call and sends no clear-on-close record.
|
|
76
93
|
|
|
@@ -90,7 +107,8 @@ instance. Other exceptions propagate.
|
|
|
90
107
|
|
|
91
108
|
== Compatibility
|
|
92
109
|
|
|
93
|
-
The gem requires Ruby >= 2.1 and <tt>rspec-core</tt> >= 3.6
|
|
94
|
-
supported Ruby engine.
|
|
110
|
+
The gem requires Ruby >= 2.1 and <tt>rspec-core</tt> >= 3.6. MRI is the
|
|
111
|
+
supported Ruby engine. CI also checks RSpec 4.0.0.beta1 on Ruby 4.0.
|
|
112
|
+
Other engines are unverified. Runtime
|
|
95
113
|
compatibility does not extend upstream security maintenance for older Ruby versions.
|
|
96
114
|
Development tools use modern Ruby, as described in CONTRIBUTING.md.
|
data/doc/usage.rdoc
CHANGED
|
@@ -52,3 +52,19 @@ is <tt>RSpec</tt>.
|
|
|
52
52
|
|
|
53
53
|
Set <tt>RSPEC_OSC7501=off</tt> to disable frames without changing the formatter
|
|
54
54
|
configuration. See {Behavior}[rdoc-ref:doc/behavior.rdoc] for settings and limits.
|
|
55
|
+
|
|
56
|
+
== Run through Rake (optional)
|
|
57
|
+
|
|
58
|
+
Install <tt>rake-osc7501</tt> alongside this gem and load the RSpec task class
|
|
59
|
+
before the integration in your Rakefile:
|
|
60
|
+
|
|
61
|
+
require 'rspec/core/rake_task'
|
|
62
|
+
require 'rake/osc7501'
|
|
63
|
+
RSpec::Core::RakeTask.new(:spec)
|
|
64
|
+
|
|
65
|
+
Run <tt>bundle exec rake spec</tt>. Rake assigns a child record and preloads
|
|
66
|
+
<tt>rspec/osc7501/managed</tt>. Existing formatter choices and their destinations
|
|
67
|
+
remain intact. Without an explicit formatter, ordinary progress remains visible.
|
|
68
|
+
Use <tt>RAKE_OSC7501=off</tt> to disable the parent's automatic activation or
|
|
69
|
+
<tt>RSPEC_OSC7501=off</tt> to silence the child. Child results remain after Rake
|
|
70
|
+
finishes, including a failed child tolerated with <tt>fail_on_error = false</tt>.
|
|
@@ -16,7 +16,7 @@ module RSpec
|
|
|
16
16
|
# The optional +clock+ callable returns monotonic seconds for throttling.
|
|
17
17
|
def initialize(output, clock: -> { Process.clock_gettime(Process::CLOCK_MONOTONIC) })
|
|
18
18
|
@writer = Writer.new(output, mode: ENV.fetch('RSPEC_OSC7501', 'auto'),
|
|
19
|
-
title: ENV.fetch('RSPEC_OSC7501_TITLE', 'RSpec'))
|
|
19
|
+
title: ENV.fetch('RSPEC_OSC7501_TITLE', 'RSpec'), id: ENV['RSPEC_OSC7501_ID'])
|
|
20
20
|
@clock = clock
|
|
21
21
|
@started = false
|
|
22
22
|
@summarized = false
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative '../osc7501'
|
|
4
|
+
|
|
5
|
+
module RSpec
|
|
6
|
+
module OSC7501
|
|
7
|
+
# Selects an additive formatter only for a managed child invocation.
|
|
8
|
+
module Managed
|
|
9
|
+
# Isolate RSpec's private formatter-loader seam to this configuration.
|
|
10
|
+
module Loader # :nodoc: all
|
|
11
|
+
def setup_default(output_stream, deprecation_stream)
|
|
12
|
+
super
|
|
13
|
+
add Formatter, output_stream unless formatters.any? { |formatter| formatter.is_a?(Formatter) }
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def self.install!(configuration = RSpec.configuration)
|
|
18
|
+
return false unless Writer.valid_id?(ENV['RSPEC_OSC7501_ID'])
|
|
19
|
+
return false if ENV['RSPEC_OSC7501'] == 'off'
|
|
20
|
+
|
|
21
|
+
loader = configuration.send(:formatter_loader)
|
|
22
|
+
return false if loader.is_a?(Loader)
|
|
23
|
+
|
|
24
|
+
loader.singleton_class.prepend(Loader)
|
|
25
|
+
true
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
RSpec::OSC7501::Managed.install!
|
data/lib/rspec/osc7501/writer.rb
CHANGED
|
@@ -3,11 +3,18 @@
|
|
|
3
3
|
module RSpec
|
|
4
4
|
module OSC7501
|
|
5
5
|
class Writer # :nodoc: all
|
|
6
|
-
def
|
|
6
|
+
def self.valid_id?(id)
|
|
7
|
+
id.is_a?(String) && id.ascii_only? && id.bytesize <= 128 &&
|
|
8
|
+
!!(id =~ %r{\A[A-Za-z0-9_.+-]{1,32}(?:/[A-Za-z0-9_.+-]{1,32}){0,7}\z})
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def initialize(output, mode:, title:, id: nil)
|
|
7
12
|
raise ArgumentError, 'RSPEC_OSC7501 must be auto, off, or force' unless %w[auto off force].include?(mode)
|
|
8
13
|
|
|
9
14
|
@output = output
|
|
10
|
-
@
|
|
15
|
+
@id = id
|
|
16
|
+
@enabled = (id.nil? || self.class.valid_id?(id)) &&
|
|
17
|
+
output_enabled?(mode)
|
|
11
18
|
@title = encode(title, 192) if @enabled
|
|
12
19
|
rescue IOError, SystemCallError
|
|
13
20
|
@enabled = false
|
|
@@ -17,6 +24,7 @@ module RSpec
|
|
|
17
24
|
return unless @enabled
|
|
18
25
|
|
|
19
26
|
fields = ['app=rspec', "title=#{@title}", "state=#{state}", "msg=#{encode(msg, 2048)}"]
|
|
27
|
+
fields << "id=#{@id}" if @id
|
|
20
28
|
fields << "progress=#{[[progress.to_i, 0].max, 100].min}" if state == 'working' && !progress.nil?
|
|
21
29
|
@output.write("\e]7501;#{fields.join(':')}\e\\")
|
|
22
30
|
@output.flush if @output.respond_to?(:flush)
|
|
@@ -26,6 +34,10 @@ module RSpec
|
|
|
26
34
|
|
|
27
35
|
private
|
|
28
36
|
|
|
37
|
+
def output_enabled?(mode)
|
|
38
|
+
mode == 'force' || (mode == 'auto' && automatic_output?)
|
|
39
|
+
end
|
|
40
|
+
|
|
29
41
|
def automatic_output?
|
|
30
42
|
ENV['TERM'] != 'dumb' && @output.respond_to?(:tty?) && @output.tty?
|
|
31
43
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rspec-osc7501
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Brian Cosgrove
|
|
@@ -16,9 +16,6 @@ dependencies:
|
|
|
16
16
|
- - ">="
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
18
|
version: '3.6'
|
|
19
|
-
- - "<"
|
|
20
|
-
- !ruby/object:Gem::Version
|
|
21
|
-
version: '4'
|
|
22
19
|
type: :runtime
|
|
23
20
|
prerelease: false
|
|
24
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -26,9 +23,6 @@ dependencies:
|
|
|
26
23
|
- - ">="
|
|
27
24
|
- !ruby/object:Gem::Version
|
|
28
25
|
version: '3.6'
|
|
29
|
-
- - "<"
|
|
30
|
-
- !ruby/object:Gem::Version
|
|
31
|
-
version: '4'
|
|
32
26
|
description: Reports RSpec suite progress and outcomes through OSC 7501.
|
|
33
27
|
email:
|
|
34
28
|
- cosgroveb@users.noreply.github.com
|
|
@@ -47,6 +41,7 @@ files:
|
|
|
47
41
|
- doc/usage.rdoc
|
|
48
42
|
- lib/rspec/osc7501.rb
|
|
49
43
|
- lib/rspec/osc7501/formatter.rb
|
|
44
|
+
- lib/rspec/osc7501/managed.rb
|
|
50
45
|
- lib/rspec/osc7501/version.rb
|
|
51
46
|
- lib/rspec/osc7501/writer.rb
|
|
52
47
|
homepage: https://github.com/cosgroveb/rspec-osc7501
|