Class: Henitai::ExcludedTestFilter

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

Overview

Drops test files matching any of the configured exclude globs.

This keeps a mutant child from re-running tests that themselves spawn henitai or forked subprocesses -- the CLI and process-scheduler specs, when dogfooding henitai on itself -- which would otherwise multiply processes and log noise.

Takes the pattern list rather than a configuration object: exclusion is a path-matching rule, and keeping it free of configuration lookup makes it directly testable.

Instance Method Summary collapse

Constructor Details

#initialize(patterns:) ⇒ ExcludedTestFilter

Returns a new instance of ExcludedTestFilter.

Parameters:

  • patterns (Array<String>, nil)

    exclude globs; nil and [] both mean "exclude nothing"



17
18
19
# File 'lib/henitai/excluded_test_filter.rb', line 17

def initialize(patterns:)
  @patterns = Array(patterns)
end

Instance Method Details

#reject(tests) ⇒ Array<String>

Returns paths not matched by any pattern.

Parameters:

  • tests (Array<String>)

    candidate test paths

Returns:

  • (Array<String>)

    paths not matched by any pattern



23
24
25
26
27
# File 'lib/henitai/excluded_test_filter.rb', line 23

def reject(tests)
  return tests if @patterns.empty?

  tests.reject { |path| excluded?(path) }
end