Class: SimpleCov::ParallelAdapters::GenericAdapter
- Defined in:
- lib/simplecov/parallel_adapters/generic.rb
Overview
Catch-all adapter for parallel test runners that follow the ‘TEST_ENV_NUMBER` / `PARALLEL_TEST_GROUPS` env-var convention but don’t ship a Ruby API for SimpleCov to hook (parallel_rspec, knapsack-style splitters, custom CI sharding scripts). Activates when ‘TEST_ENV_NUMBER` is set; doesn’t require any specific gem to be loaded.
Heuristic for ‘first_worker?`: the worker whose `TEST_ENV_NUMBER` is `“”` (parallel_tests/parallel_rspec convention) or `“1”` (zero-based runners that start at 1). Any other value is treated as a non-first worker.
‘wait_for_siblings` is inherited from Base as a no-op — without a runner-provided API the only synchronization available is polling the resultset cache, which `SimpleCov.wait_for_parallel_results` does after the no-op returns.
Class Method Summary collapse
- .active? ⇒ Boolean
- .expected_worker_count ⇒ Object
-
.first_worker? ⇒ Boolean
parallel_tests sets the first worker’s TEST_ENV_NUMBER to “”; parallel_rspec inherits that.
Methods inherited from Base
Class Method Details
.active? ⇒ Boolean
25 26 27 |
# File 'lib/simplecov/parallel_adapters/generic.rb', line 25 def active? ENV.key?("TEST_ENV_NUMBER") end |
.expected_worker_count ⇒ Object
36 37 38 |
# File 'lib/simplecov/parallel_adapters/generic.rb', line 36 def expected_worker_count ENV["PARALLEL_TEST_GROUPS"]&.to_i || 1 end |
.first_worker? ⇒ Boolean
parallel_tests sets the first worker’s TEST_ENV_NUMBER to “”; parallel_rspec inherits that. Runners that number from 1 use “1” for the first worker. Both shapes match.
32 33 34 |
# File 'lib/simplecov/parallel_adapters/generic.rb', line 32 def first_worker? ["", "1"].include?(ENV.fetch("TEST_ENV_NUMBER", nil)) end |