Class: SimpleCov::Formatter::JSONFormatter
- Defined in:
- lib/simplecov/formatter/json_formatter.rb,
lib/simplecov/formatter/json_formatter/errors_formatter.rb,
lib/simplecov/formatter/json_formatter/result_hash_formatter.rb,
lib/simplecov/formatter/json_formatter/source_file_formatter.rb,
sig/simplecov.rbs
Overview
Writes coverage results as JSON to coverage/coverage.json.
Defined Under Namespace
Classes: ErrorsFormatter, ResultHashFormatter, SourceFileFormatter
Constant Summary collapse
- FILENAME =
CoverageJSONWriter::FILENAME
Class Method Summary collapse
-
.build_hash(result, include_source: SimpleCov.source_in_json) ⇒ Hash[Symbol, untyped]
The hash serialized to coverage.json ($schema, meta, total, coverage, groups, errors).
Instance Method Summary collapse
Methods inherited from Base
#displayable_output_path, #emit_status, #initialize, #output_message, #output_path, #relative_or_absolute_output_path, #stats_line
Constructor Details
This class inherits a constructor from SimpleCov::Formatter::Base
Class Method Details
.build_hash(result, include_source: SimpleCov.source_in_json) ⇒ Hash[Symbol, untyped]
The hash serialized to coverage.json ($schema, meta, total,
coverage, groups, errors). include_source: defaults to
SimpleCov.source_in_json; pass true to force the per-file
source arrays regardless of the global setting.
20 21 22 |
# File 'lib/simplecov/formatter/json_formatter.rb', line 20 def self.build_hash(result, include_source: SimpleCov.source_in_json) ResultHashFormatter.format(result, include_source: include_source) end |
Instance Method Details
#entry_point_filename ⇒ String
35 36 37 |
# File 'lib/simplecov/formatter/json_formatter.rb', line 35 def entry_point_filename FILENAME end |
#format(result) ⇒ void
This method returns an undefined value.
24 25 26 27 |
# File 'lib/simplecov/formatter/json_formatter.rb', line 24 def format(result) CoverageJSONWriter.write(output_path, self.class.build_hash(result), result) emit_status(result) end |
#message_prefix ⇒ String
31 32 33 |
# File 'lib/simplecov/formatter/json_formatter.rb', line 31 def "JSON " end |