Class: Evilution::Integration::TestUnit::TestFileResolver Private

Inherits:
Object
  • Object
show all
Defined in:
lib/evilution/integration/test_unit/test_file_resolver.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Resolves the list of test files to load for a given mutation. Encapsulates the explicit-override path, spec-selector lookup, fallback glob, and the warn-once behaviour for unresolved sources. The integration class would otherwise carry both per-instance test resolution state (@test_files, @spec_selector, @warned_files, @fallback_to_full_suite) and dispatch orchestration in the same object; splitting them gives the resolver its own change axis (e.g. adding new resolution heuristics) independent of the runner.

Instance Method Summary collapse

Constructor Details

#initialize(test_files:, spec_selector:, fallback_to_full_suite:) ⇒ TestFileResolver

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of TestFileResolver.



14
15
16
17
18
19
# File 'lib/evilution/integration/test_unit/test_file_resolver.rb', line 14

def initialize(test_files:, spec_selector:, fallback_to_full_suite:)
  @test_files = test_files
  @spec_selector = spec_selector
  @fallback_to_full_suite = fallback_to_full_suite
  @warned_files = Set.new
end

Instance Method Details

#call(mutation_file_path) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns the resolved file list, or nil if the source could not be resolved and fallback is disabled.



23
24
25
26
27
28
29
30
31
# File 'lib/evilution/integration/test_unit/test_file_resolver.rb', line 23

def call(mutation_file_path)
  return @test_files if @test_files

  resolved = Array(@spec_selector.call(mutation_file_path))
  return resolved unless resolved.empty?

  warn_unresolved(mutation_file_path)
  @fallback_to_full_suite ? glob_test_files : nil
end