Module: SimpleCov::Formatter::HTMLFormatter::ViewerDataValidator

Defined in:
lib/simplecov/formatter/html_formatter/viewer_data_validator.rb

Overview

Validates the subset of coverage.json that the browser viewer dereferences without defensive fallbacks.

Class Method Summary collapse

Class Method Details

.call(data) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/simplecov/formatter/html_formatter/viewer_data_validator.rb', line 21

def call(data)
  %w[meta total coverage groups].each { |key| validate_section!(data, key) }
  meta = data.fetch("meta")
  validate_meta!(meta)
  validate_statistics!(data.fetch("total"), meta, "total")
  data.fetch("coverage").each { |filename, file| validate_file!(filename, file) }
  data.fetch("groups").each { |name, group| validate_group!(name, group, meta) }
  data
end