Class: Henitai::ExcludedTestFilter
- Inherits:
-
Object
- Object
- Henitai::ExcludedTestFilter
- 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
-
#initialize(patterns:) ⇒ ExcludedTestFilter
constructor
A new instance of ExcludedTestFilter.
-
#reject(tests) ⇒ Array<String>
Paths not matched by any pattern.
Constructor Details
#initialize(patterns:) ⇒ ExcludedTestFilter
Returns a new instance of ExcludedTestFilter.
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.
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 |