Class: Henitai::SurvivorLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/henitai/survivor_loader.rb

Overview

Reads a Stryker-compatible mutation report and extracts survivor data.

Returns a Report value object carrying:

- +survivor_ids+  — stable IDs of survived mutants
- +coverage_map+  — stableId → [test_files] from prior coveredBy data
- +git_sha+       — git HEAD at the time the report was written (may be nil)

Scope validation is intentionally shallow: checks schemaVersion presence and at least one file path overlap with config.includes.

Defined Under Namespace

Classes: FileNotFoundError, InvalidReportError, Report, ScopeMismatchError

Instance Method Summary collapse

Constructor Details

#initialize(path, include_paths: []) ⇒ SurvivorLoader

Returns a new instance of SurvivorLoader.

Parameters:

  • path (String)

    path to a Stryker-compatible JSON report

  • include_paths (Array<String>) (defaults to: [])

    from config.includes; used for scope validation



25
26
27
28
# File 'lib/henitai/survivor_loader.rb', line 25

def initialize(path, include_paths: [])
  @path          = path
  @include_paths = include_paths
end

Instance Method Details

#loadReport

Returns:



31
32
33
34
35
36
# File 'lib/henitai/survivor_loader.rb', line 31

def load
  raw    = read_file
  report = parse_json(raw)
  validate_scope(report)
  build_report(report)
end