Module: SimpleCov::TestTracker::Accessors

Included in:
SimpleCov
Defined in:
lib/simplecov/test_tracker/accessors.rb

Instance Method Summary collapse

Instance Method Details

#start_test_trackingObject

reason Coverage keeps counting across them: restarting must not lose what the process already recorded. The framework hooks are only wired up on the first.



25
26
27
28
29
30
31
# File 'lib/simplecov/test_tracker/accessors.rb', line 25

def start_test_tracking
  validate_test_tracking!
  return unless track_tests? && test_tracker.nil?

  @test_tracker = TestTracker.new(granularity: track_tests_granularity)
  TestTracker.install_framework_hooks
end

#test_trackerObject



17
18
19
# File 'lib/simplecov/test_tracker/accessors.rb', line 17

def test_tracker
  @test_tracker
end

#track_test(test_id) ⇒ Object

Records the block's coverage delta as covered by test_id, returning the block's value. This is the seam test frameworks hang per-test tracking on. A no-op, with the block still running, unless track_tests is enabled and tracking has started, so callers never guard it.



10
11
12
13
14
15
# File 'lib/simplecov/test_tracker/accessors.rb', line 10

def track_test(test_id, &)
  tracker = test_tracker
  return yield unless tracker

  tracker.track(test_id, &)
end