Class: Henitai::RunnerDependencies
- Inherits:
-
Object
- Object
- Henitai::RunnerDependencies
- Defined in:
- lib/henitai/runner_dependencies.rb,
sig/henitai.rbs
Overview
The collaborators Runner drives, built on first use.
Extracted so each one can be asserted on directly — several are chosen by
configuration (the integration adapter, the operator set, which progress
reporters are composed) and that choice had no test seam while it lived
behind private readers on Runner.
Memoization is not an optimisation here, it is a correctness requirement for #per_test_coverage and #history_store: the incremental filter proves survivor reuse against the same live coverage map the history store records its intersection set from. Two instances would be two snapshots.
Instance Method Summary collapse
- #coverage_bootstrapper ⇒ CoverageBootstrapper
- #execution_engine ⇒ Object
- #git_diff_analyzer ⇒ Object
- #history_store ⇒ Object
-
#initialize(config:) ⇒ RunnerDependencies
constructor
A new instance of RunnerDependencies.
- #integration ⇒ Object
- #mutant_generator ⇒ Object
- #operators ⇒ Array[Operator]
- #per_test_coverage ⇒ PerTestCoverage
-
#progress_reporter(full_run:) ⇒ Object
Fans progress out to the terminal reporter (when enabled) and the checkpoint writer (when enabled and a file report is configured), so a long run persists partial results incrementally.
-
#source_provider ⇒ ^(String) -> String
Reads each source file once and caches it per path, so Result consumes source content while performing no disk IO of its own.
- #static_filter ⇒ Object
- #subject_resolver ⇒ Object
Constructor Details
#initialize(config:) ⇒ RunnerDependencies
Returns a new instance of RunnerDependencies.
16 17 18 |
# File 'lib/henitai/runner_dependencies.rb', line 16 def initialize(config:) @config = config end |
Instance Method Details
#coverage_bootstrapper ⇒ CoverageBootstrapper
25 |
# File 'lib/henitai/runner_dependencies.rb', line 25 def coverage_bootstrapper = @coverage_bootstrapper ||= CoverageBootstrapper.new |
#execution_engine ⇒ Object
24 |
# File 'lib/henitai/runner_dependencies.rb', line 24 def execution_engine = @execution_engine ||= ExecutionEngine.new |
#git_diff_analyzer ⇒ Object
21 |
# File 'lib/henitai/runner_dependencies.rb', line 21 def git_diff_analyzer = @git_diff_analyzer ||= GitDiffAnalyzer.new |
#history_store ⇒ Object
39 40 41 42 43 44 |
# File 'lib/henitai/runner_dependencies.rb', line 39 def history_store @history_store ||= MutantHistoryStore.new( path: File.join(@config.reports_dir, Henitai::HISTORY_STORE_FILENAME), per_test_coverage: per_test_coverage ) end |
#integration ⇒ Object
27 28 29 |
# File 'lib/henitai/runner_dependencies.rb', line 27 def integration @integration ||= Integration.for(@config.integration).new end |
#mutant_generator ⇒ Object
22 |
# File 'lib/henitai/runner_dependencies.rb', line 22 def mutant_generator = @mutant_generator ||= MutantGenerator.new |
#operators ⇒ Array[Operator]
31 32 33 |
# File 'lib/henitai/runner_dependencies.rb', line 31 def operators @operators ||= Operator.for_set(@config.operators) end |
#per_test_coverage ⇒ PerTestCoverage
35 36 37 |
# File 'lib/henitai/runner_dependencies.rb', line 35 def per_test_coverage @per_test_coverage ||= PerTestCoverage.new(reports_dir: @config.reports_dir) end |
#progress_reporter(full_run:) ⇒ Object
Fans progress out to the terminal reporter (when enabled) and the checkpoint writer (when enabled and a file report is configured), so a long run persists partial results incrementally.
Deliberately not memoized: full_run? is a property of the invocation,
not of the dependency set, and a cached reporter would silently keep the
first answer.
53 54 55 |
# File 'lib/henitai/runner_dependencies.rb', line 53 def progress_reporter(full_run:) CompositeProgressReporter.for(config: @config, source_provider: source_provider, full_run: full_run) end |
#source_provider ⇒ ^(String) -> String
Reads each source file once and caches it per path, so Result consumes source content while performing no disk IO of its own. Unreadable files (recipe stubs with synthetic locations, say) answer "" rather than aborting the run.
Not memoized: each call gets its own cache, scoped to one reporter's lifetime rather than shared across the process.
64 65 66 67 68 69 70 71 72 73 |
# File 'lib/henitai/runner_dependencies.rb', line 64 def source_provider cache = {} # : Hash[String, String] lambda do |file| cache[file] ||= begin File.read(file) rescue StandardError "" end end end |
#static_filter ⇒ Object
23 |
# File 'lib/henitai/runner_dependencies.rb', line 23 def static_filter = @static_filter ||= StaticFilter.new |
#subject_resolver ⇒ Object
20 |
# File 'lib/henitai/runner_dependencies.rb', line 20 def subject_resolver = @subject_resolver ||= SubjectResolver.new |