Class: Henitai::CoverageBootstrapper
- Inherits:
-
Object
- Object
- Henitai::CoverageBootstrapper
- Defined in:
- lib/henitai/coverage_bootstrapper.rb
Overview
Ensures coverage data exists before the mutation pipeline starts.
Instance Method Summary collapse
-
#ensure!(source_files:, config:, integration:, test_files: nil) ⇒ Object
Runs the test suite to collect coverage, unless a fresh report already exists.
-
#initialize(static_filter: StaticFilter.new) ⇒ CoverageBootstrapper
constructor
A new instance of CoverageBootstrapper.
Constructor Details
#initialize(static_filter: StaticFilter.new) ⇒ CoverageBootstrapper
Returns a new instance of CoverageBootstrapper.
6 7 8 |
# File 'lib/henitai/coverage_bootstrapper.rb', line 6 def initialize(static_filter: StaticFilter.new) @static_filter = static_filter end |
Instance Method Details
#ensure!(source_files:, config:, integration:, test_files: nil) ⇒ Object
Runs the test suite to collect coverage, unless a fresh report already exists.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/henitai/coverage_bootstrapper.rb', line 18 def ensure!(source_files:, config:, integration:, test_files: nil) return if source_files.empty? # Skip the bootstrap only when the coverage artifacts are both newer than # all watched files and actually cover the configured sources. A fresh # but irrelevant report (e.g. from a different working directory) must # still trigger a re-bootstrap rather than silently proceeding with no # usable coverage. unless coverage_ready?(source_files, config, integration, test_files) bootstrap_coverage(integration, config, test_files) end return if coverage_available?(source_files, config, test_files) raise CoverageError, "Coverage data is unavailable for the configured source files" end |