Class: Henitai::MinitestCoverageReporter

Inherits:
Minitest::Reporter
  • Object
show all
Defined in:
lib/henitai/minitest_coverage_reporter.rb

Overview

Minitest reporter that collects per-test line coverage deltas.

Added to Minitest’s reporter chain by the henitai_coverage plugin (see minitest_coverage_hook.rb). Delegates accumulation and serialisation to PerTestCoverageCollector so the JSON output format is identical to the RSpec integration.

Instance Method Summary collapse

Constructor Details

#initialize(io = $stdout, options = {}) ⇒ MinitestCoverageReporter

Returns a new instance of MinitestCoverageReporter.



14
15
16
17
# File 'lib/henitai/minitest_coverage_reporter.rb', line 14

def initialize(io = $stdout, options = {})
  super
  @collector = PerTestCoverageCollector.new
end

Instance Method Details

#record(result) ⇒ Object



19
20
21
22
# File 'lib/henitai/minitest_coverage_reporter.rb', line 19

def record(result)
  super
  @collector.record_test(relative_to_pwd(result.source_location.first))
end

#reportObject



24
25
26
27
# File 'lib/henitai/minitest_coverage_reporter.rb', line 24

def report
  super
  @collector.write_report
end