Module: Henitai::Reporter

Defined in:
lib/henitai/reporter.rb

Overview

Namespace for result reporters.

Each reporter receives a Result object and writes output in its specific format. Reporters are selected via ‘reporters:` in .henitai.yml.

Built-in reporters:

terminal  — coloured summary table to STDOUT
json      — mutation-testing-report-schema JSON file
html      — self-contained HTML using mutation-testing-elements web component
dashboard — POST to Stryker Dashboard REST API

Defined Under Namespace

Classes: Base, Dashboard, Html, Json, Terminal

Class Method Summary collapse

Class Method Details

.reporter_class(name) ⇒ Object



34
35
36
37
38
# File 'lib/henitai/reporter.rb', line 34

def self.reporter_class(name)
  const_get(name.capitalize)
rescue NameError
  raise ArgumentError, "Unknown reporter: #{name}. Valid reporters: terminal, json, html, dashboard"
end

.run_all(names:, result:, config:, history_store: nil) ⇒ Object

Parameters:

  • names (Array<String>)

    reporter names from configuration

  • result (Result)
  • config (Configuration)
  • history_store (MutantHistoryStore, nil) (defaults to: nil)

    persistence store the JSON reporter reads trend data from; supplied by the composition root so the reporter does not build infrastructure itself.



28
29
30
31
32
# File 'lib/henitai/reporter.rb', line 28

def self.run_all(names:, result:, config:, history_store: nil)
  names.each do |name|
    reporter_class(name).new(config:, history_store:).report(result)
  end
end