rspec-tracer 1.2.0 → 1.2.2
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/CHANGELOG.md +54 -0
- data/lib/rspec_tracer/cache.rb +14 -2
- data/lib/rspec_tracer/load_default_config.rb +8 -0
- data/lib/rspec_tracer/version.rb +1 -1
- data/lib/rspec_tracer.rb +26 -16
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0f6c19e285b64650bd4f02c5820fed75c10806ebb97900e17607b84532dfb483
|
|
4
|
+
data.tar.gz: a4e17229c1efa3d43e1cc850b908cb9bbcb16fb6f217098348675ce2a798c993
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 25571686f98b2c1939a0497f3c34a7f0508d856ba94ac2aabd6f293815a4e61ad8cb2b56d8a22c4ff211692a6609c1f8671d6b55f35d2123301d15bf8d70649b
|
|
7
|
+
data.tar.gz: 1c86b20818bc6f18bc5a3faf69f6a7b7908b1ab6006a1301341883edb46f3d180db3cd6308978f9d12dbd6f9b427dcd478c3addc7888f78faa64dc1b325897ce
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,57 @@
|
|
|
1
|
+
## [1.2.2] - 2026-05-04
|
|
2
|
+
|
|
3
|
+
### Fixed
|
|
4
|
+
|
|
5
|
+
- **Default filter list now excludes rspec-tracer's own output
|
|
6
|
+
directories** (`rspec_tracer_cache/`, `rspec_tracer_coverage/`,
|
|
7
|
+
`rspec_tracer_report/`, and the `rspec_tracer.lock` file). Prior
|
|
8
|
+
versions did not exclude these paths, so any spec that read a tracer
|
|
9
|
+
cache file (typical for outer integration specs that assert on cache
|
|
10
|
+
state after a fixture subprocess run) had those paths attributed as
|
|
11
|
+
dependencies. The user-visible symptom was reverse-dependency reports
|
|
12
|
+
showing tracer-self paths as deps of unrelated specs, plus
|
|
13
|
+
spurious files-changed re-runs whenever the tracer rewrote its own
|
|
14
|
+
cache. Both `add_filter` and `add_coverage_filter` defaults updated.
|
|
15
|
+
|
|
16
|
+
- **Carry-forward filter contract** — newly added filters now apply
|
|
17
|
+
uniformly to both fresh attribution AND prior-snapshot carry-forward.
|
|
18
|
+
Previously, `Cache#load_all_files_cache` and `load_dependency_cache`
|
|
19
|
+
read previous-run state without re-applying the current filter list.
|
|
20
|
+
A user adding a new filter mid-development saw the filter take
|
|
21
|
+
effect only for fresh attributions on cold runs; previously-cached
|
|
22
|
+
paths matching the new filter persisted in `all_files` and
|
|
23
|
+
`dependency` until the next cold run. Filter additions now take
|
|
24
|
+
effect on the very next warm run.
|
|
25
|
+
|
|
26
|
+
## [1.2.1] - 2026-05-01
|
|
27
|
+
|
|
28
|
+
### Fixed
|
|
29
|
+
|
|
30
|
+
- **Parallel-tests merge silently dropped peer caches and left worker
|
|
31
|
+
directories behind** when the spawned-worker count exceeded
|
|
32
|
+
`ENV['PARALLEL_TEST_GROUPS']`. The merge + purge call-sites in
|
|
33
|
+
`lib/rspec_tracer.rb` (`merge_parallel_tests_reports`,
|
|
34
|
+
`merge_parallel_tests_coverage_reports`,
|
|
35
|
+
`purge_parallel_tests_reports`) iterated `1..ENV['PARALLEL_TEST_GROUPS']`
|
|
36
|
+
to construct per-worker directory names. But parallel_tests sets
|
|
37
|
+
`PARALLEL_TEST_GROUPS = num_processes.to_s` for each child, where
|
|
38
|
+
`num_processes` is the user-requested process count
|
|
39
|
+
(`Parallel.processor_count` by default) — not the actual worker
|
|
40
|
+
count. When `num_processes < spawned_worker_count` (e.g. when the
|
|
41
|
+
spec-count partition produces more non-empty groups than
|
|
42
|
+
`num_processes`, or shared-runner CPU detection drifts mid-run),
|
|
43
|
+
peer caches with `TEST_ENV_NUMBER` above the env bound were silently
|
|
44
|
+
dropped from the merge (warm-run skip decisions get made against
|
|
45
|
+
an under-sampled merged manifest) and left behind by the purge
|
|
46
|
+
(visible as straggler `parallel_tests_<N>/` directories under
|
|
47
|
+
`rspec_tracer_cache/`). The same gem behaviour was documented on
|
|
48
|
+
v1.1.1's `last_process?` fix
|
|
49
|
+
([PR #101](https://github.com/avmnu-sng/rspec-tracer/pull/101)) but
|
|
50
|
+
the iteration call-sites kept the buggy bound. Each method now globs
|
|
51
|
+
the actual `parallel_tests_*` subdirectories under its base path,
|
|
52
|
+
making the merge + purge robust to whatever count parallel_tests
|
|
53
|
+
spawned. No cache format change.
|
|
54
|
+
|
|
1
55
|
## [1.2.0] - 2026-04-24
|
|
2
56
|
|
|
3
57
|
### Added
|
data/lib/rspec_tracer/cache.rb
CHANGED
|
@@ -171,9 +171,10 @@ module RSpecTracer
|
|
|
171
171
|
|
|
172
172
|
return unless File.file?(file_name)
|
|
173
173
|
|
|
174
|
-
|
|
174
|
+
raw = JSON.parse(File.read(file_name, encoding: 'UTF-8')).transform_values do |files|
|
|
175
175
|
files.transform_keys(&:to_sym)
|
|
176
176
|
end
|
|
177
|
+
@all_files = raw.reject { |fname, _| filtered_by_current_filters?(fname) }
|
|
177
178
|
end
|
|
178
179
|
|
|
179
180
|
def load_dependency_cache(cache_dir)
|
|
@@ -181,7 +182,18 @@ module RSpecTracer
|
|
|
181
182
|
|
|
182
183
|
return unless File.file?(file_name)
|
|
183
184
|
|
|
184
|
-
|
|
185
|
+
raw = JSON.parse(File.read(file_name, encoding: 'UTF-8')).transform_values(&:to_set)
|
|
186
|
+
@dependency = raw.transform_values do |files|
|
|
187
|
+
files.reject { |fname| filtered_by_current_filters?(fname) }.to_set
|
|
188
|
+
end
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
# True iff `file_name` matches any currently-configured filter.
|
|
192
|
+
# Applied at carry-forward seed time so newly-added filters take
|
|
193
|
+
# effect on the very next warm run instead of waiting for a cold
|
|
194
|
+
# run.
|
|
195
|
+
def filtered_by_current_filters?(file_name)
|
|
196
|
+
RSpecTracer.filters.any? { |f| f.match?(file_name: file_name) }
|
|
185
197
|
end
|
|
186
198
|
|
|
187
199
|
def load_examples_coverage_cache(cache_dir)
|
|
@@ -16,6 +16,10 @@ RSpecTracer.configure do
|
|
|
16
16
|
/.rbenv/versions/
|
|
17
17
|
/.asdf/installs/ruby/
|
|
18
18
|
/.rvm/
|
|
19
|
+
/rspec_tracer_cache/
|
|
20
|
+
/rspec_tracer_coverage/
|
|
21
|
+
/rspec_tracer_report/
|
|
22
|
+
rspec_tracer.lock
|
|
19
23
|
].freeze
|
|
20
24
|
|
|
21
25
|
coverage_filters.clear
|
|
@@ -33,6 +37,10 @@ RSpecTracer.configure do
|
|
|
33
37
|
/.rbenv/versions/
|
|
34
38
|
/.asdf/installs/ruby/
|
|
35
39
|
/.rvm/
|
|
40
|
+
/rspec_tracer_cache/
|
|
41
|
+
/rspec_tracer_coverage/
|
|
42
|
+
/rspec_tracer_report/
|
|
43
|
+
rspec_tracer.lock
|
|
36
44
|
].freeze
|
|
37
45
|
end
|
|
38
46
|
# rubocop:enable Metrics/BlockLength
|
data/lib/rspec_tracer/version.rb
CHANGED
data/lib/rspec_tracer.rb
CHANGED
|
@@ -330,12 +330,7 @@ module RSpecTracer
|
|
|
330
330
|
starting = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
|
331
331
|
reports_dir = []
|
|
332
332
|
|
|
333
|
-
|
|
334
|
-
cache_path = File.dirname(RSpecTracer.cache_path)
|
|
335
|
-
cache_dir = File.join(cache_path, "parallel_tests_#{test_num}")
|
|
336
|
-
|
|
337
|
-
next unless File.directory?(cache_dir)
|
|
338
|
-
|
|
333
|
+
parallel_tests_peer_dirs(File.dirname(RSpecTracer.cache_path)).each do |cache_dir|
|
|
339
334
|
run_id = JSON.parse(File.read(File.join(cache_dir, 'last_run.json'), encoding: 'UTF-8'))['run_id']
|
|
340
335
|
|
|
341
336
|
reports_dir << File.join(cache_dir, run_id)
|
|
@@ -365,14 +360,8 @@ module RSpecTracer
|
|
|
365
360
|
return unless parallel_tests_executed? && !simplecov?
|
|
366
361
|
|
|
367
362
|
starting = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
|
368
|
-
reports_dir = []
|
|
369
363
|
|
|
370
|
-
|
|
371
|
-
coverage_path = File.dirname(RSpecTracer.coverage_path)
|
|
372
|
-
coverage_dir = File.join(coverage_path, "parallel_tests_#{test_num}")
|
|
373
|
-
|
|
374
|
-
reports_dir << coverage_dir if File.directory?(coverage_dir)
|
|
375
|
-
end
|
|
364
|
+
reports_dir = parallel_tests_peer_dirs(File.dirname(RSpecTracer.coverage_path))
|
|
376
365
|
|
|
377
366
|
coverage_merger.merge(reports_dir)
|
|
378
367
|
|
|
@@ -401,13 +390,34 @@ module RSpecTracer
|
|
|
401
390
|
def purge_parallel_tests_reports
|
|
402
391
|
return unless parallel_tests_executed?
|
|
403
392
|
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
FileUtils.rm_rf(
|
|
393
|
+
[RSpecTracer.cache_path, RSpecTracer.coverage_path, RSpecTracer.report_path].each do |path|
|
|
394
|
+
parallel_tests_peer_dirs(File.dirname(path)).each do |worker_dir|
|
|
395
|
+
FileUtils.rm_rf(worker_dir)
|
|
407
396
|
end
|
|
408
397
|
end
|
|
409
398
|
end
|
|
410
399
|
|
|
400
|
+
# Returns every `parallel_tests_*` subdirectory directly under
|
|
401
|
+
# `base_path`. Used by the parallel_tests merge + purge paths.
|
|
402
|
+
#
|
|
403
|
+
# Earlier patches iterated `1..ENV['PARALLEL_TEST_GROUPS'].to_i`
|
|
404
|
+
# to construct dir names, but parallel_tests's own runner sets
|
|
405
|
+
# PARALLEL_TEST_GROUPS to the user-requested process count
|
|
406
|
+
# (`Parallel.processor_count` by default), NOT the actual worker
|
|
407
|
+
# count. When num_processes < spawned_worker_count, the upper
|
|
408
|
+
# bound was too small: peer caches with TEST_ENV_NUMBER above the
|
|
409
|
+
# bound were silently dropped from the merge AND left behind by
|
|
410
|
+
# the purge. PR #101's commit message documented this gem
|
|
411
|
+
# behaviour for `last_process?` detection but did not extend the
|
|
412
|
+
# fix to the iteration call-sites; this method closes that gap.
|
|
413
|
+
# Globbing the actual filesystem state is robust to the env
|
|
414
|
+
# discrepancy regardless of how the gem partitions specs.
|
|
415
|
+
def parallel_tests_peer_dirs(base_path)
|
|
416
|
+
Dir.glob(File.join(base_path, 'parallel_tests_*')).select do |path|
|
|
417
|
+
File.directory?(path)
|
|
418
|
+
end
|
|
419
|
+
end
|
|
420
|
+
|
|
411
421
|
def parallel_tests_executed?
|
|
412
422
|
return false unless parallel_tests? && parallel_tests_last_process?
|
|
413
423
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rspec-tracer
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.2.
|
|
4
|
+
version: 1.2.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Abhimanyu Singh
|
|
@@ -111,7 +111,7 @@ licenses:
|
|
|
111
111
|
- MIT
|
|
112
112
|
metadata:
|
|
113
113
|
homepage_uri: https://github.com/avmnu-sng/rspec-tracer
|
|
114
|
-
source_code_uri: https://github.com/avmnu-sng/rspec-tracer/tree/v1.2.
|
|
114
|
+
source_code_uri: https://github.com/avmnu-sng/rspec-tracer/tree/v1.2.2
|
|
115
115
|
changelog_uri: https://github.com/avmnu-sng/rspec-tracer/blob/main/CHANGELOG.md
|
|
116
116
|
bug_tracker_uri: https://github.com/avmnu-sng/rspec-tracer/issues
|
|
117
117
|
rdoc_options: []
|