Conversation
Min Ruby is 3.1+, so the upstream method is always available. The SimpleCov-side flag was a duplicate that test mocks could flip out from under the at_exit pipeline.
…eCov Add filters: / groups: keyword arguments defaulting to SimpleCov.filters / SimpleCov.groups so existing call sites are unchanged. Tests can pass filters: [] or an explicit list to opt out of the singleton entirely. Also flip Metrics/ParameterLists CountKeywordArgs to false, which is more honest than spot-disabling on the constructor.
Add output_dir: keyword (default nil → SimpleCov.coverage_path) so formatter specs and the dogfood can write somewhere other than the project's coverage/ directory. JSONFormatter's output message reflects the explicit directory too. SimpleFormatter is pure-string and MultiFormatter still instantiates wrapped formatters with no args.
start kept its public signature: it now just calls initial_setup then start_tracking. The split lets dogfood test setups call start_tracking directly (after starting Coverage early themselves) without inheriting a fresh, empty configuration.
defaults.rb auto-registered the at_exit block on every require. Move the registration into a new idempotent SimpleCov.install_at_exit_hook; SimpleCov.start calls it, SimpleCov.start_tracking deliberately doesn't. A no-op for normal users — the auto-hook returned early anyway when start hadn't been called.
Bootstrap Coverage in spec/helper.rb before requiring simplecov, then drive the formatter ourselves in an after(:suite) hook. Threshold defaults to 100% and the build exits MINIMUM_COVERAGE when under; SIMPLECOV_NO_DOGFOOD=1 skips the bootstrap. Two follow-ups it surfaced: HTMLFormatter#format and JSONFormatter#format now mkdir_p their output_dir, and simplecov_spec stubs Coverage.running? to false in the start_coverage_measurement examples (Coverage is already running under the dogfood bootstrap).
Backfill ~30 specs across simplecov, configuration, source_file, file_list, filters, result_merger, multi_formatter, simulate_coverage, and the three ExitCodes/*Check#report cases that lacked them. Mark genuinely-unreachable paths with # simplecov:disable: parallel_tests and JRuby branches, the .simplecov dotfile autoloader, ~/.simplecov, the simplecov-profile-* gem fallback, the directive.rb encoding rescues, the Configuration#formatters MultiFormatter-instance dead branch, and SourceFile#parse_array_element's defensive ArgumentError. Also drop the unused Directive#enabled? method.
Enable :branch in after(:suite) and threshold both line and branch at 100%. Add branch-targeting specs for the testable conditionals and bare gates, SIMPLECOV_NO_DEFAULTS, the at_exit Proc.new fallback, status's covered? else nil). Also drop unnecessary &. operators in FileList and SourceFile where the receiver is invariantly non-nil (line stats are always set; SourceFile always assembles a full :line/:branch/:method coverage_statistics hash). Those were producing dead 'else' branches.
Enable :method in after(:suite) and threshold all three criteria. Two real fixes fell out: restore SourceFile#parse_ruby_array_string's 'try plain Ripper, then pre-quote on failure' approach (method-coverage keys for simplecov-on-simplecov take the form ["#<Class:SimpleCov>", :name, ...] — valid Ruby with the wrapper inside a quoted string), and merge singleton + instance method-coverage keys in ResultAdapter#normalize_method_keys (Ruby's Coverage records module_function methods twice; only one form is reachable, so the other was always 0).
CRuby is the primary target and stays at 100% on line, branch, and method. JRuby and TruffleRuby `skip` specs that exercise branch/method coverage paths their Coverage module doesn't support, so the lib/ lines those specs would have hit stay uncovered there (~97.8% line on JRuby, 97.91% on TruffleRuby). Set their line thresholds at 97.5% — small buffer below today's actual, still catches meaningful regressions. Engines absent from DOGFOOD_THRESHOLDS get an informational HTML report only. Surfaced by https://github.com/simplecov-ruby/simplecov/actions/runs/25472411032
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For #786.