Module: RSpecTracer::RSpec::ReporterHook Private

Defined in:
lib/rspec_tracer/rspec/reporter_hook.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Prepended onto ‘RSpec::Core::Reporter` by `RSpecTracer::RSpec::Installation.install!`. Replaces the 1.x `RSpecTracer::RSpecReporter` singleton-class prepend.

Forwards RSpec’s example lifecycle notifications into the engine, then chains to ‘super`. Every callback is no-op when either:

- the engine isn't set up (start never called, graceful degrade)
- the example carries no `:rspec_tracer_example_id` metadata
  (it was partitioned into `ignore_spec_files` by RunnerHook, so
  the tracer treats it as invisible)

The per-example coverage peek+diff sequence (peek before, peek after) runs through Engine#example_started + Engine#example_finished only. 2.0 retired the legacy CoverageReporter that previously peeked a second time per example; coverage.json emission now consumes the Engine’s per-example deltas + a single finalize-time peek through Tracker::CoverageAdapter#peek_unfiltered.

Instance Method Summary collapse

Instance Method Details

#example_failed(example) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Internal method on the tracer pipeline.



55
56
57
58
59
# File 'lib/rspec_tracer/rspec/reporter_hook.rb', line 55

def example_failed(example)
  _rspec_tracer_status(example, :on_example_failed)

  super
end

#example_finished(example) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Internal method on the tracer pipeline.



35
36
37
38
39
40
41
42
43
# File 'lib/rspec_tracer/rspec/reporter_hook.rb', line 35

def example_finished(example)
  engine = RSpecTracer.engine
  if engine
    example_id = example.[:rspec_tracer_example_id]
    engine.example_finished(example_id) if example_id
  end

  super
end

#example_passed(example) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Internal method on the tracer pipeline.



47
48
49
50
51
# File 'lib/rspec_tracer/rspec/reporter_hook.rb', line 47

def example_passed(example)
  _rspec_tracer_status(example, :on_example_passed)

  super
end

#example_pending(example) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Internal method on the tracer pipeline.



63
64
65
66
67
# File 'lib/rspec_tracer/rspec/reporter_hook.rb', line 63

def example_pending(example)
  _rspec_tracer_status(example, :on_example_pending)

  super
end

#example_started(_example) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Internal method on the tracer pipeline.



27
28
29
30
31
# File 'lib/rspec_tracer/rspec/reporter_hook.rb', line 27

def example_started(_example)
  RSpecTracer.engine&.example_started

  super
end