Class: ActiveMutator::Reporter::StrykerJson
- Inherits:
-
Object
- Object
- ActiveMutator::Reporter::StrykerJson
- Defined in:
- lib/active_mutator/reporter/stryker_json.rb
Overview
mutation-testing-report-schema v2 (the Stryker ecosystem format). Load the written file in https://microsoft.github.io/mutation-testing-elements/ for the interactive per-file mutant viewer.
Schema constraints honored here: 1-based positive line/column, integer thresholds, tool-specific data only under config.active_mutator. Invalid mutants are discarded before results exist, so they appear as a count in the extras, never as CompileError mutants.
Constant Summary collapse
- SCHEMA_URL =
"https://git.io/mutation-testing-schema"- STATUS =
{ killed: "Killed", survived: "Survived", timeout: "Timeout", error: "RuntimeError", uncovered: "NoCoverage", accepted: "Ignored" }.freeze
- ACCEPTED_REASON =
"Accepted as equivalent in #{AcceptedLedger::FILENAME}".freeze
- REPORT_PATH =
File.join(".active_mutator", "mutation-report.json")
Instance Attribute Summary collapse
-
#coverage_map ⇒ Object
writeonly
Injected by Runner once the baseline map exists; nil in unit tests.
Instance Method Summary collapse
-
#initialize(root:, out: $stdout) ⇒ StrykerJson
constructor
A new instance of StrykerJson.
- #on_result(result) ⇒ Object
- #summary(results, invalid_count:) ⇒ Object
Constructor Details
#initialize(root:, out: $stdout) ⇒ StrykerJson
Returns a new instance of StrykerJson.
23 24 25 26 27 |
# File 'lib/active_mutator/reporter/stryker_json.rb', line 23 def initialize(root:, out: $stdout) @root = root @out = out @coverage_map = nil end |
Instance Attribute Details
#coverage_map=(value) ⇒ Object (writeonly)
Injected by Runner once the baseline map exists; nil in unit tests.
21 22 23 |
# File 'lib/active_mutator/reporter/stryker_json.rb', line 21 def coverage_map=(value) @coverage_map = value end |
Instance Method Details
#on_result(result) ⇒ Object
29 30 31 |
# File 'lib/active_mutator/reporter/stryker_json.rb', line 29 def on_result(result) @out.print(Terminal::CHARS.fetch(result.status)) end |
#summary(results, invalid_count:) ⇒ Object
33 34 35 36 37 38 |
# File 'lib/active_mutator/reporter/stryker_json.rb', line 33 def summary(results, invalid_count:) report = build_report(results, invalid_count) path = File.join(@root, REPORT_PATH) AtomicFile.write(path, JSON.pretty_generate(report)) @out.puts "", "", "Stryker report written to #{REPORT_PATH}" end |