rspec_telemetry 0.4.0 → 0.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5c0f4a3e6ec69cd97b7aa3c4a5160d354339e30cdd0f9954dee2866674fdef68
4
- data.tar.gz: f5ceb63cd260c16f06fb9b51e6ce843c89f141b9f9ae2ae246cc559e0d41022e
3
+ metadata.gz: 796f640dcbe14855620f29d78972456705d29af7025b3e01171e9f4d76dfca04
4
+ data.tar.gz: 271548c28826a191510187593eaef599771f964c16b3061c7e6d6751e4dbd7fd
5
5
  SHA512:
6
- metadata.gz: 1070d3497148bcaf1241ce4b30228c3b6089327194b93c52ec94aff5ccd720af11dc6c10d9fda5d4e9dd868298861aff712345c8104d1d0f3af7a26db9cb3c0c
7
- data.tar.gz: ee999d564466cac64f328b95503f1e3161fbd850b1badff30691b99d48baae5e357491b64a0dfb84c134b92a3abff4e5990c6e2b5f5d601c4670adfce7286c9a
6
+ metadata.gz: 960b867f5af3ed3a290d637422dee0436ec10b72b7554a9bb348329cd7ba561dbeaca388148cb41f39c1e616708f570d8c2466855f6321cbd1f9bfbf4861e464
7
+ data.tar.gz: 1ddef07a9486a993f55073db7a717e185dba269cacc4f379dc43e117b42b35edebb09a07d81a2be9d652a07eb2208fced3e13faff4f3e70a82a78a71780c577b
data/CHANGELOG.md CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.5.0] - 2026-07-16
6
+
7
+ ### Added
8
+ - `RSPEC_TELEMETRY_OUTPUT` environment variable to redirect the NDJSON output
9
+ path per run (e.g. to keep before/after measurements side by side) without
10
+ editing `spec_helper.rb`. It takes precedence over the `TEST_ENV_NUMBER`
11
+ worker suffix.
12
+
13
+ ### Changed
14
+ - Require `tui_tui ~> 0.4`. The interactive viewer now uses the namespaced
15
+ `TuiTui::Widget` / `TuiTui::Modal` widgets and requests a full repaint via
16
+ `TuiTui::Command::Invalidate` instead of the removed `redraw?` hook.
17
+
5
18
  ## [0.4.0] - 2026-06-30
6
19
 
7
20
  ### Added
@@ -44,7 +57,8 @@
44
57
 
45
58
  First public release.
46
59
 
47
- [Unreleased]: https://github.com/takahashim/rspec_telemetry/compare/v0.4.0...HEAD
60
+ [Unreleased]: https://github.com/takahashim/rspec_telemetry/compare/v0.5.0...HEAD
61
+ [0.5.0]: https://github.com/takahashim/rspec_telemetry/compare/v0.4.0...v0.5.0
48
62
  [0.4.0]: https://github.com/takahashim/rspec_telemetry/compare/v0.3.0...v0.4.0
49
63
  [0.3.0]: https://github.com/takahashim/rspec_telemetry/compare/v0.2.0...v0.3.0
50
64
  [0.2.0]: https://github.com/takahashim/rspec_telemetry/compare/v0.1.0...v0.2.0
data/README.md CHANGED
@@ -52,6 +52,15 @@ If you want to specify the formatter explicitly in `.rspec`:
52
52
  > To disable automatic formatter registration, set the environment variable
53
53
  > `RSPEC_TELEMETRY_NO_AUTOLOAD=1`.
54
54
 
55
+ ### Redirecting the output file
56
+
57
+ Each run overwrites `tmp/rspec_telemetry.ndjson`. Set `RSPEC_TELEMETRY_OUTPUT`
58
+ to redirect a single run elsewhere (e.g. to keep before/after results):
59
+
60
+ ```bash
61
+ RSPEC_TELEMETRY_OUTPUT=tmp/rt-before.ndjson bundle exec rspec
62
+ ```
63
+
55
64
  ## Configuration
56
65
 
57
66
  ```ruby
@@ -29,6 +29,11 @@ module RSpecTelemetry
29
29
  end
30
30
 
31
31
  def self.default_output_path
32
+ # An explicit path wins so a single run can be redirected without editing
33
+ # spec_helper (e.g. to keep before/after measurements side by side).
34
+ explicit = ENV["RSPEC_TELEMETRY_OUTPUT"]
35
+ return explicit if explicit && !explicit.empty?
36
+
32
37
  suffix = ENV["TEST_ENV_NUMBER"]
33
38
  if suffix && !suffix.empty?
34
39
  "tmp/rspec_telemetry.#{suffix}.ndjson"
@@ -58,7 +58,7 @@ module RSpecTelemetry
58
58
  @follow_ctl = FollowController.new(source: source, active: follow)
59
59
  @source_view = SourceView.new(source_root: source_root, base_dir: base_dir)
60
60
  @renderer = AppRenderer.new
61
- @list = TuiTui::ScrollList.new
61
+ @list = TuiTui::Widget::ScrollList.new
62
62
  @detail_scroll = 0
63
63
  @focus_ring = TuiTui::FocusRing.new(:timeline, :detail)
64
64
  @modal = nil
@@ -76,11 +76,13 @@ module RSpecTelemetry
76
76
 
77
77
  def wants_tick? = @follow_ctl.wants_tick?
78
78
 
79
- def redraw?(event) = event.is_a?(TuiTui::KeyEvent) && event.key == REDRAW
80
-
81
79
  def update(event)
82
80
  case event
83
81
  when TuiTui::KeyEvent
82
+ # Ctrl-L forces a full repaint; 0.4 requests it via a command rather
83
+ # than the removed redraw? hook.
84
+ return [self, TuiTui::Command::Invalidate.new] if event.key == REDRAW
85
+
84
86
  @modal ? route_modal(event) : handle_key_event(event)
85
87
  when TuiTui::MouseEvent
86
88
  @modal ? route_modal(event) : handle_mouse(event)
@@ -139,7 +141,7 @@ module RSpecTelemetry
139
141
  end
140
142
 
141
143
  def confirm_quit
142
- open_modal(TuiTui::Confirm.new("Quit the trace viewer?", theme: Theme.base)) { |r| :quit if r == :ok }
144
+ open_modal(TuiTui::Modal::Confirm.new("Quit the trace viewer?", theme: Theme.base)) { |r| :quit if r == :ok }
143
145
  end
144
146
 
145
147
  def handle_key_event(event)
@@ -155,7 +157,7 @@ module RSpecTelemetry
155
157
  when "q"
156
158
  confirm_quit
157
159
  when "?"
158
- open_modal(TuiTui::Help.new("Keys", HELP, theme: Theme.base)) { nil }
160
+ open_modal(TuiTui::Modal::Help.new("Keys", HELP, theme: Theme.base)) { nil }
159
161
  when "1"
160
162
  set_view(:timeline)
161
163
  when "2"
@@ -14,7 +14,7 @@ module RSpecTelemetry
14
14
  def length = @lines.length
15
15
 
16
16
  def draw(canvas, rect)
17
- TuiTui::TextView.draw(canvas, rect, top: @scroll, scrollbar: Theme.base, total: @lines.length) do |index|
17
+ TuiTui::Widget::TextView.draw(canvas, rect, top: @scroll, scrollbar: Theme.base, total: @lines.length) do |index|
18
18
  line = @lines[index]
19
19
  next nil if line.nil?
20
20
 
@@ -14,7 +14,7 @@ module RSpecTelemetry
14
14
 
15
15
  def draw(canvas, rect)
16
16
  highlight = @focus ? Theme::SELECT : Theme::SELECT_BLUR
17
- TuiTui::List.new(@list).draw(canvas, rect, highlight: highlight, scrollbar: Theme.base) do |index, selected|
17
+ TuiTui::Widget::List.new(@list).draw(canvas, rect, highlight: highlight, scrollbar: Theme.base) do |index, selected|
18
18
  row = @rows[index]
19
19
  style = selected ? highlight : Theme.style(row.style)
20
20
  TuiTui::Line[TuiTui::Span[row.text, style]]
@@ -124,7 +124,7 @@ module RSpecTelemetry
124
124
  end
125
125
 
126
126
  def open_filter(app)
127
- app.open_modal(TuiTui::Prompt.new("Filter:", value: @filter.to_s, theme: Theme.base)) do |result|
127
+ app.open_modal(TuiTui::Modal::Prompt.new("Filter:", value: @filter.to_s, theme: Theme.base)) do |result|
128
128
  apply_filter(app, result[1]) if result.is_a?(Array)
129
129
  end
130
130
  end
@@ -141,7 +141,7 @@ module RSpecTelemetry
141
141
 
142
142
  app
143
143
  .open_modal(
144
- TuiTui::Select.new("Jump to example", rows.map { |i| Label.plain(@visible[i]) }, theme: Theme.base)
144
+ TuiTui::Modal::Select.new("Jump to example", rows.map { |i| Label.plain(@visible[i]) }, theme: Theme.base)
145
145
  ) do |result|
146
146
  app.go_to(rows[result]) if result.is_a?(Integer)
147
147
  end
@@ -48,7 +48,7 @@ module RSpecTelemetry
48
48
 
49
49
  def draw_window(canvas, body)
50
50
  top = window_top(body.rows)
51
- TuiTui::TextView.draw(canvas, body, top: top) do |index|
51
+ TuiTui::Widget::TextView.draw(canvas, body, top: top) do |index|
52
52
  text = @lines[index]
53
53
  next nil if text.nil?
54
54
 
@@ -26,7 +26,7 @@ module RSpecTelemetry
26
26
 
27
27
  file, target = source_location(location)
28
28
  lines = numbered_source(@resolver.lines_for(file), target, file)
29
- TuiTui::Pager.new(
29
+ TuiTui::Modal::Pager.new(
30
30
  "source: #{location}",
31
31
  lines,
32
32
  start: [target - 4, 0].max,
@@ -31,7 +31,7 @@ module RSpecTelemetry
31
31
 
32
32
  def draw(canvas, rect)
33
33
  right = "#{@position} #{@notice || HINTS} "
34
- TuiTui::StatusBar.draw(canvas, rect, left: left_text, right: right, style: Theme::BAR)
34
+ TuiTui::Widget::StatusBar.draw(canvas, rect, left: left_text, right: right, style: Theme::BAR)
35
35
  end
36
36
 
37
37
  private
@@ -24,7 +24,7 @@ module RSpecTelemetry
24
24
 
25
25
  def draw(canvas, rect)
26
26
  highlight = @focus ? Theme::SELECT : Theme::SELECT_BLUR
27
- TuiTui::List.new(@list).draw(canvas, rect, highlight: highlight, scrollbar: Theme.base) do |index, selected|
27
+ TuiTui::Widget::List.new(@list).draw(canvas, rect, highlight: highlight, scrollbar: Theme.base) do |index, selected|
28
28
  entry = @entries[index]
29
29
  text = prefix(entry) + Label.plain(entry) + duration_suffix(entry)
30
30
  style = selected ? highlight : Theme.style(Label.category(entry))
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RSpecTelemetry
4
- VERSION = "0.4.0"
4
+ VERSION = "0.5.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec_telemetry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - takahashimm
@@ -29,14 +29,14 @@ dependencies:
29
29
  requirements:
30
30
  - - "~>"
31
31
  - !ruby/object:Gem::Version
32
- version: '0.2'
32
+ version: '0.4'
33
33
  type: :runtime
34
34
  prerelease: false
35
35
  version_requirements: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '0.2'
39
+ version: '0.4'
40
40
  description: Collect RSpec / FactoryBot telemetry as NDJSON to find slow tests.
41
41
  email:
42
42
  - takahashimm@gmail.com