Class: MutationTester::Reporters::JsonReporter
- Inherits:
-
BaseReporter
- Object
- BaseReporter
- MutationTester::Reporters::JsonReporter
- Defined in:
- lib/mutation_tester/reporters/json_reporter.rb
Constant Summary collapse
- SCHEMA_VERSION =
1
Instance Attribute Summary
Attributes inherited from BaseReporter
#config, #results, #source_file, #spec_file
Instance Method Summary collapse
Methods inherited from BaseReporter
#initialize, #interrupted?, score, status_for
Constructor Details
This class inherits a constructor from MutationTester::Reporters::BaseReporter
Instance Method Details
#generate ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/mutation_tester/reporters/json_reporter.rb', line 8 def generate output_file = File.join(@config.output_dir, 'mutation_report.json') File.write(output_file, render) puts Rainbow("✓ JSON report saved to: #{output_file}").green output_file end |
#render ⇒ Object
16 17 18 |
# File 'lib/mutation_tester/reporters/json_reporter.rb', line 16 def render @render ||= JSON.pretty_generate(report_data) end |
#report_data ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/mutation_tester/reporters/json_reporter.rb', line 20 def report_data { schema_version: SCHEMA_VERSION, interrupted: interrupted?, metadata: { version: MutationTester::VERSION, generated_at: Time.now.iso8601, source_file: @source_file, spec_file: @spec_file }, summary: { total: total_count, killed: effective_killed_count, survived: survived_count, mutation_score: mutation_score, quality_rating: , categories: { killed: killed_count, survived: survived_count, timeout: timeout_count, stillborn: stillborn_count, error: error_count } }, mutations: @results.map { |r| mutation_entry(r) } } end |