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 runners that follow the TEST_ENV_NUMBER / PARALLEL_TEST_GROUPS env-var convention without shipping a Ruby API (parallel_rspec, knapsack-style splitters, custom CI sharding). Activates when TEST_ENV_NUMBER is set, unless SimpleCov.parallel_tests false opted out.

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)


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

def active?
  return false if forced_off?

  ENV.key?("TEST_ENV_NUMBER")
end

.expected_worker_countInteger

Returns:

  • (Integer)


39
40
41
# File 'lib/simplecov/parallel_adapters/generic.rb', line 39

def expected_worker_count
  parallel_test_groups_count
end

.first_worker?Boolean

First worker is TEST_ENV_NUMBER "" (parallel_tests convention) or "1" (runners that number from 1).

Returns:

  • (Boolean)


35
36
37
# File 'lib/simplecov/parallel_adapters/generic.rb', line 35

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