Class: SimpleCov::ParallelAdapters::GenericAdapter

Inherits:
Base
  • Object
show all
Defined in:
lib/simplecov/parallel_adapters/generic.rb,
sig/simplecov.rbs

Overview

Catch-all adapter for parallel test runners that follow the TEST_ENV_NUMBER / PARALLEL_TEST_GROUPS env-var convention but ship no Ruby API for SimpleCov to hook. 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.

Class Method Summary collapse

Methods inherited from Base

forced_off?, native_wait?, parallel_test_groups_count, wait_for_siblings

Class Method Details

.active?Boolean

Returns:

  • (Boolean)


14
15
16
17
18
# File 'lib/simplecov/parallel_adapters/generic.rb', line 14

def active?
  return false if forced_off?

  ENV.key?("TEST_ENV_NUMBER")
end

.expected_worker_countInteger

Returns:

  • (Integer)


27
28
29
# File 'lib/simplecov/parallel_adapters/generic.rb', line 27

def expected_worker_count
  parallel_test_groups_count
end

.first_worker?Boolean

parallel_tests sets the first worker's TEST_ENV_NUMBER to "", and runners that number from 1 use "1". Both shapes match; any other value is a non-first worker.

Returns:

  • (Boolean)


23
24
25
# File 'lib/simplecov/parallel_adapters/generic.rb', line 23

def first_worker?
  ["", "1"].include?(ENV.fetch("TEST_ENV_NUMBER", nil))
end