chore(deps): update dependency simplecov to v1 - #1263
Conversation
863ffdf to
6ecabea
Compare
6ecabea to
e8131c9
Compare
e942160 to
7807e03
Compare
7807e03 to
a2c1cde
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## staging #1263 +/- ##
===========================================
+ Coverage 77.70% 79.68% +1.97%
===========================================
Files 54 54
Lines 1413 1378 -35
===========================================
Hits 1098 1098
+ Misses 315 280 -35 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
8e43c65 to
02de9fa
Compare
02de9fa to
caa0011
Compare
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This PR contains the following updates:
'~> 0.22.0'→'~> 1.3.0'Release Notes
simplecov-ruby/simplecov (simplecov)
v1.3.0Compare Source
==================
SimpleCov 1.3 raises the minimum Ruby to 3.3, brings the coverage directives to ERB, Haml, and Slim templates,
teaches
simplecov patchandsimplecov uncoveredto annotate CI hosts natively, and settles what the report saysabout files and groups that hold nothing.
Highlights
# simplecov:disableand# simplecov:enablework inside ERB, Haml, and Slim templates measured withcover_views, in each language's own comment syntax or as Ruby comments on a code line.--annotate KINDturnssimplecov patchandsimplecov uncoveredinto inline CI annotations for GitHub, GitLab, reviewdog, Azure, TeamCity, and Buildkite, so one CI step can both annotate and gate.railsprofile declares its groups alphabetically.cover_viewsis the only way to measure a template now: acoverglob that matches one warns and leaves it out, andignore: :eval_generatedno longer drops a template's real branches and methods.Upgrade notes
coverage.json, and the history file, and a per-group minimum on it passes silently rather than complaining that the group does not exist.railsprofile's group tabs come out in alphabetical order, so an existing project's tabs move.coverglob matching.erb,.haml, or.slimwarns and drops those files from the report. Measure templates withcover_viewsinstead.coverage.jsonstays at schema 1.3, unchanged by this release.Breaking Changes
required_ruby_version >= 3.3), with JRuby 10 still supported and TruffleRuby exercised only by the nightly unstable build. Prism is bundled with every supported Ruby, so the static coverage extractor stops probing for it:StaticCoverageExtractor.available?and the empty-hash fallbacks for its absence are gone. So is the emulation of Ruby 3.2's constant folding, where parentheses were transparent for every literal and a folded dead arm's branches survived in the branch table.Enhancements
# simplecov:disableand# simplecov:enablework inside ERB, Haml, and Slim templates measured withcover_views, in each language's own comment syntax (<%# simplecov:disable %>,-# simplecov:disable,/ simplecov:disable) or as Ruby comments on a code line. A template's directives were never found before: the comment scan tokenizes a file as Ruby, and in ERB%>opens a percent literal that swallowed every comment after the template's first tag, while Haml and Slim comments are not Ruby comments at all and a Slim- # simplecov:disableline even read as an inline directive that disabled only itself. The scan now reads only the Ruby a template holds, at the template's own lines, so a Devise app can disable theconfirmablelink it never renders instead of carrying it as uncovered. See #1295.coverage.json, and the history file all skip them, so therailsprofile'sChannels,Mailers, andViewstabs no longer pad the HTML report of an app without those directories, and a project can declare a group per directory it might have (Dir["app/*"].each { |dir| group File.basename(dir).capitalize, dir }) without checking each one for Ruby files first. Aminimum_coverage_by_groupthreshold on a group that matched nothing passes silently, as it did when the empty group reported 100%, rather than complaining that the group does not exist. See #1293.railsprofile declares its groups in alphabetical order:Channels,Controllers,Helpers,Jobs,Libraries,Mailers,Models,Views. Group tabs render in declaration order, so the report of a Rails app lists them that way instead of in the order they accumulated over the years. Nothing else about the groups changes, and a project that declares its own groups is unaffected.simplecov patchandsimplecov uncoveredannotate CI hosts natively.--annotate KINDon both commands turns the answer into inline annotations in the host's own channel, one per contiguous missed range with project-relative paths (patchadds one per uncovered touched branch or method when the report measured them):githubemits::warningworkflow commands,gitlaba Code Quality report for thecodequalityartifact,rdjsonreviewdog's Diagnostic Format for any host reviewdog posts to,azure##vso[task.logissue]logging commands,teamcitycode inspection service messages, andbuildkitethe Markdown body forbuildkite-agent annotate.uncoveredpreviously offered onlygithub, and its annotations now name the chosen criterion the waypatch's do. Nothing else reaches stdout in that mode andpatch --minimumstill sets the exit status, so one CI step can annotate and gate. Documented under CI annotations in docs/CLI.md.Bugfixes
coverglob that matches a template warns and leaves it out instead of simulating it. Simulation classifies lines as Ruby and parses for branches, so a swept-in template appeared with a comment counted as a missed line, an#idtag counted as never relevant, and no branches at all. The warning names the templates and points atcover_views, which compiles them and measures the real thing.# :nocov:toggle works in a template's own comment syntax (<%# :nocov: %>,-# :nocov:,/ :nocov:) and emits its deprecation warning there. The matcher read raw lines and needed the line to begin with#, so those forms were silently ignored while the Ruby-comment form inside an ERB code tag happened to work. The matcher now reads the same extracted Ruby the directives do.ignore: :eval_generatedno longer drops a template's real branches and methods. The filter keeps a Coverage entry only when Prism finds a matching construct in the static source, which for a template measured withcover_viewsmeant parsing ERB, Haml, or Slim as Ruby. That usually fails and the entry is kept, but a template whose text happens to parse (a Haml or Slim#idtag reads as a Ruby comment, and so does an ERB text line starting with#) yielded a confident wrong parse, and the template's own conditionals vanished from branch coverage. Templates now skip the parse, since everything a template reports is eval-generated by construction and the filter has nothing to distinguish there.v1.2.0Compare Source
==================
SimpleCov 1.2 adds change-focused coverage, per-test attribution, production coverage, and a substantially expanded
CLI while keeping the existing configuration API working through deprecation aliases.
Highlights
track_tests,simplecov tests, andsimplecov affectedconnect covered lines to the tests that exercised them; the HTML report displays the same attribution andsimplecov watchuses it for focused reruns.simplecov patch, per-file baselines, missed-count caps, and coverage history make coverage gates useful for both new changes and legacy codebases.SimpleCov::Productionrecords low-overhead production line coverage, whilesimplecov dead-codeand the bundled reports cross it with test coverage.cover_views, including ERB, Haml, and Slim source highlighting.Upgrade notes
coverage/.history.jsonfile by default. Sethistory_limit 0to disable it.coverage(:criterion) { ignore ... }andminimum ..., per: .... The legacy forms warn with their exact replacements, anddeprecations :raisecan enforce a completed migration.coverage.jsonadvances additively to schema 1.3 for test-context, history, baseline-error, and production data. Previously published versioned schemas remain frozen for pinned consumers.Enhancements
The HTML report's source view renders the
track_testsrecording. A covered line no recorded test executed drains from green to a slate tint, with a "Covered outside tests" legend chip, so coverage produced only by load time, suite setup, or helpers stops passing for tested code at a glance. Every executed line carries a tests badge naming its count, and clicking it opens an inline panel listing the covering tests, the same ids in the same ordersimplecov tests file:lineprints, each one selectable with a click for handing to a runner. Drained lines explain themselves in the same panel instead of listing nothing. The file header's Line coverage row splits its fraction by the same attribution ("Line coverage: 100.00% 21/30 relevant lines covered by tests, 9/30 relevant lines covered outside tests"), the legend's covered chip splits to match (green "Covered by tests" beside the slate "Covered outside tests"), keyboard access rides on real buttons with the report's focus ring, and the panel closes on Escape without closing the source dialog. The file list draws the same distinction: each line coverage bar splits its fill into the share recorded tests produced (in the usual band colour) and a slate share covered only outside them, in the file rows and the live-filtered totals row alike, and sorting by line coverage breaks ties on the by-tests share, so of two files at 100% the one whose coverage rests on its tests ranks above the one warmed by load time. All of it appears only when the report was generated withtrack_testsenabled, so other reports render exactly as before.simplecov patchreports coverage of just the lines a change touched, the questiondiffdoes not answer. Wherediffcompares two reports and asks whether the overall number moved — which a large or legacy project cannot shift in one pull request —patchreadsgit diff --unified=0 --merge-base <base>, intersects the added and modified line numbers with the current report, and prints line coverage — and, when the report measured branches or methods, branch and method coverage over the branches and methods those lines carry — for only that change, so a project sitting at 40% can still insist that everything it adds is tested.--minimum Nexits non-zero below a floor (every measured criterion must clear it), composing with CI as a per-change gate alongside the existing thresholds;--baseselects the ref to diff against (defaulting to the branch origin's HEAD points at, elsemain; in CI, the target branch or its merge-base);--find-renamesfollows a moved file instead of counting it as all-new; and--jsonemits the rows the other read-only commands do. Only files the report already carries are scored, and a lineLinesClassifierdeems never relevant stays out of the denominator the same way it stays out of a file's total, so a comment-only or whitespace change reads as nothing to cover rather than as a gap. A brand-new file that was nevergit added appears in no diff yet is still the change's work, so untracked files are scored too, every report-known line of them as new. The diff is anchored at the repository root rather than the working directory, so a run from a subdirectory reports the same change, and changed files resolve against the report by exact path, so a lookalike entry elsewhere in the report can never be scored in a changed file's place. A changed line beyond what the report knows for its file draws a staleness warning instead of silently scoring nothing, a git failure reports git's own words rather than a guess, and a path that matches more than one report entry names its candidates, incoverageandteststoo, instead of a bare "no entry". Almost none of this is new machinery: the report already knows which lines are relevant and which were hit, leaving a hunk-header parser and path resolution against the report's root. Prior art isdiff-cover, Codecov's patch status, and theundercovergem, which does this for Ruby but needs its own formatter and a git dependency to get there. See #1262.track_testsrecording got a cost model and the levers to control it. Recording now settles at segment boundaries: consecutive tests share their boundary coverage snapshot (one snapshot closes one test's segment and opens the next, attributing any in-between code to the later test), which halves the per-test sampling cost outright, and the project-root check is memoized per file. On top of that,track_tests granularity: :filerecords one context per test file instead of per test, so the suite pays one snapshot per change of file in run order rather than one per test, and test selection needs no more than file identity anyway. On a real 1,756-test Minitest suite measuring line, branch, and method coverage, the two changes together cut tracking overhead from 52 seconds to 28 at the default granularity and to 13 at:file. The remaining floor is Ruby's ownCoverage.peek_resultcopy, which scales with the criteria the run measures: a millisecond or two under line coverage alone, an order of magnitude more with branch and method tables, which the docs now spell out.simplecov testsanswers which tests cover a file or line, from the terminal. Bare, it lists every test recorded undertrack_tests. With a path it narrows to the tests touching that file, and withpath:lineto one line. Text output is one test id per line and nothing else on stdout, sorted, so the list can feed a runner directly (simplecov tests lib/foo.rb:42 | xargs bundle exec rspec), with empty answers noted on stderr instead.--jsonemits a JSON array, and--inputpicks the report like the other read-only subcommands. It reads thecontextsdata incoverage.json, so it works on any report generated aftertrack_testswas enabled, and explains what to enable when the recording is missing.simplecov tests --redundantlists the tests whose covered lines other tests also cover, the tests contributing no coverage of their own, computed from the sametrack_testsrecording with no new measurement. The flag composes with the narrowing, sosimplecov tests --redundant lib/foo.rblists the redundant tests among those touching the file. The listed ids are candidates for review rather than a delete list: assertions and mutation-killing power are invisible to coverage, and two tests covering exactly the same lines subsume each other, so both are listed and deleting both would lose the lines. An empty answer over a real recording is good news and says so on stderr.simplecov affectedselects the tests that touch changed code. It diffs the working tree against the merge base of a git ref (--base, defaulting to the branch origin's HEAD points at, elsemain) and HEAD, so uncommitted work counts as part of the change while commits that landed on the base after the branch point do not, includes untracked files, and prints the test files whose recorded tests touch the changed files, so the local inner loop can runsimplecov affected --run bundle exec rspecinstead of the whole suite. Everything after--runis the runner command, the selection is appended to it, and the exit status is the command's own. The set intersection is the easy half. The hard half is knowing when to distrust the map, because a test map is stale the moment something changes that no test mentions by name, so any changed file outside the tracked set fails open to the full suite, out loud: a changedGemfile.lock,.simplecov, spec helper, runner configuration, or any file the report has no data for is named on stderr as the trigger, while stdout prints nothing, which a bare runner reads as run everything. Changed or brand-new test files always select themselves, recorded or not, a test file deleted by the change drops out of the answer, and a recorded test whose file no longer exists anywhere else reads as staleness rather than being silently skipped.--jsonemits the selection with itsfull_suiteverdict and triggers for tooling, and--inputpicks the report like the other read-only subcommands. Likepatch, the diff is anchored at the repository root, so a run from a subdirectory selects over the whole change, with--runstarting the runner at that root, and changed files resolve against the report by exact path, so a lookalike entry elsewhere in the report can never stand in for a changed file the report does not carry. Built for the local inner loop first, because a wrong answer in CI is a green build on a broken change. See #1264.track_testsin aSimpleCov.startblock samples coverage around every RSpec example and Minitest test, and stores the map in.resultset.jsonunder a versionedcontextskey beside the merged coverage, exposed asSimpleCov::Result#contextswith acovering(path, line)lookup. The data layer speaks of contexts rather than tests because the mechanism is general and matches the vocabulary a future Coverage library feature would use, while undertrack_testsevery context is one test. Test ids are interned and each test's covered lines are packed into per-file bitmaps, which keeps the naive tests-times-lines storage in hand. Merges union the maps when every merged result recorded one and drop them out loud otherwise, across suites, concurrent runners, parallel workers, andsimplecov collatealike, since a partial map would present one worker's tests as the whole run's. The Minitest wrapper installs through the minitest 5 plugin, and under minitest 6, whose autorun no longer discovers plugins, the momentMinitest::Testis defined. Other runners wrap their own units of work withSimpleCov.track_test. Tests running concurrently in threads inside one process cannot be told apart, because coverage counters are process-global, so such a process warns and stores no map rather than a misattributed one, while process-parallel workers each record their own. The serialized map carries a format version, so a future format reads as absent instead of being misread. The map also flows intocoverage.json, the durable artifact downstream tools build on, as a document-levelcontextsarray plus per-file hex bitmaps, under coverage.json schema 1.1 (schemas/coverage-v1.1.schema.json, with 1.0 staying frozen for pinned integrations, and the new keys optional so documents without recordings stay minimal). Opt-in because sampling around every test costs run time and the map costs space. Needs regular line coverage, so:oneshot_lineis rejected at startup, because a line reports only its first hit ever and every later test's delta would miss it. See #1263.ActionView templates can be part of the report.
cover_viewsin aSimpleCov.startblock turns on eval coverage, which is what measures a template the suite renders, and compiles the templates it never renders so they appear at 0% rather than not at all. Rendering already produced usable data, because ActionView compiles each template withmodule_eval(source, identifier, offset)where the identifier is the template's own path and the offset cancels thedefline its wrapper adds, so the generated code is attributed back to the.erbfile at the template's own line numbers and nothing needs remapping. The gap was the other half: a template no test renders is never compiled, soCoveragenever hears about it, and the views with no coverage were exactly the ones the report omitted.cover_viewsdefaults to a Rails app's views, takes globs of its own for templates that live elsewhere, and honorsskiplike any other file in the report. Therailsprofile gains a matchingViewsgroup, which stays empty in a project that has not opted in. Needs CRuby 3.2 or later, which is what eval coverage needs. See #1265.The source view highlights each file by its own language rather than assuming Ruby. A
.erbtemplate used to be handed to the Ruby grammar, which declines to match markup and left the view almost entirely unhighlighted, so templates now go through an ERB grammar that marks up the tags and highlights what is between them as Ruby. It is a small grammar of SimpleCov's own rather than the one highlight.js ships, whose markup is delegated to a full XML grammar that carries a literal</scriptthe report cannot inline (the whole report is oneindex.htmlwith its JavaScript in a<script>element) and that would have cost around 5KB in every report written. The one shipped costs 627 bytes.The changelog is back at
CHANGELOG.mdin the project root, where the convention documented at keepachangelog.com puts it and where humans and tooling look for it. Moving it underdocs/was never what kept it out of the packaged gem:gem.fileslists what ships, so the file stays unpackaged where it is. The gem'schangelog_urimetadata follows it back, and the pre-0.18 entries stay atdocs/Changelog.old.md. See #1272.cover_viewsreaches Haml and Slim, and its default glob is nowapp/views/**/*.{erb,haml,slim}. Nothing was needed to measure them beyond looking the handler up the way ActionView's own resolver does: both generate Ruby that keeps the template's line structure, so hits land on the lines their authors wrote. The same goes for any other language a project has registered a handler for, which needs only its extension named in a glob. An extension with no registered handler is now left out of the report instead of being compiled through ActionView's raw handler, which would have reported a project that has no Haml a file of static text for every.hamlits default glob happened to match. The source view highlights Haml and Slim as themselves, the second through a small grammar of SimpleCov's own since highlight.js ships none.simplecov watchturns the report into something you look at while writing the test. It serves the report the wayservedoes, polls the tracked files for saves, re-runs the given command when something changes, and pushes a reload to the open tab over server-sent events the moment the report regenerates, with the result line naming the change and the coverage delta ("lib/result.rb changed, running 3 files... 100.00% (+0.40%)"), the number following the report's primary criterion. With atrack_testsrecording in the report a save re-runs only the tests touching the changed files, by the same selection walksimplecov affecteduses and with the same fail-open rule, and without one every save runs the full command. The watched set is the report's own tracked files plus the recorded tests' files, polled by mtime rather than through a filesystem-event dependency, which also keeps report writes from triggering the next run. Child runs get a day-long merge window through the newSIMPLECOV_MERGE_TIMEOUTenvironment variable (honored bymerge_timeoutgenerally), so subset re-runs keep merging into a whole report across a long session. The report on disk stays byte-identical to a plain run's, with the reload listener added only on the way out of the server, and--openpops the report in the default browser on start. See #1269.simplecov show <path>prints annotated source in the terminal, the waygo tool coverandllvm-cov showdo: hit counts in the gutter, a caret marker naming each miss under its line, and branch and method misses annotated the same way when the report measured them.--uncovered-onlycollapses the answer topath:40,52-58,71, a form that greps, fits in a commit message, and hands a coding agent exactly the lines whose tests are missing, and--jsonemits the whole annotation as data (missed lines, per-line hits, marker labels) for editor integrations. With no path,--uncovered-onlysweeps the whole project into onepath:rangesline per file with misses, and a bare--jsonemits the same sweep as data. Colors follow the usualNO_COLOR,FORCE_COLOR, and--no-colorrules. The source comes from the report itself when it embeds one, and otherwise from disk, accepted only while the file's line count still matches the report's, since annotating drifted source would put hit counts on the wrong lines. See #1270.simplecov statusanswers "is this report fresh?" from metadata the artifacts have carried all along: the report's age, the SimpleCov version and run that produced it, the recorded commit and how many commits HEAD has moved since, the measured totals, whether atrack_testsmap is present (and what to enable when it isn't), and the resultset's entries with their ages.--jsonemits the same facts as data. Every staleness question the change-aware commands raise now has a one-command answer.simplecov uncovered --missingappends the missed line ranges to each row (50.00% 5/10 lib/foo.rb missing 4-7,9), following the chosen criterion (zero-hit lines, or the lines missed branches and methods report on), and adds amissingarray to each--jsonrow, so the list says not just where to add tests but which lines they're for.--annotate githubemits::warningworkflow commands instead of rows, one per contiguous missed range, so a plain GitHub Actions workflow gets inline diff annotations with no upload step and no code-scanning permissions.simplecov badgerenders the report's percentage as a flat SVG badge in the shields.io style, to stdout or to a file with--output, so a README or CI artifact can carry the number straight from the local report with no badge service in the loop. The color follows the ladder badge services use for coverage (bright green at 90% and above, stepping down to red below 50%),--criterionpicks the line, branch, or method percentage, and the label names the chosen criterion ("line coverage", "branch coverage", "method coverage") unless--labelreplaces it. The percent comes from the totalscoverage.jsonalready carries, so the badge always matches what the other read-only commands report.simplecov completions fish|bash|zshprints a tab-completion script for the named shell, covering every subcommand with its description and each command's own options. The script is generated from the usage document itself rather than a hand-kept table, so a new command or option appears in completions the moment it is documented.The gem ships a man page,
man/simplecov.1, covering every CLI command and option with the environment variables and files the commands honor. Like the shell completions, it is generated from the usage document (rake manregenerates it) so it cannot drift, and the suite fails when the committed copy is stale. RubyGems does not install man pages ontoMANPATH, so read it withman $(gem contents simplecov | grep man/simplecov.1)or let a system package manager place it.Every CLI command answers
--help/-hwith its own slice of the usage text: the command's row, its options, and the shared options it accepts, instead of the full listing. It also replaces what optparse's built-in handler did before, which was to print a bare option summary under the host program's banner and exit the process from inside the parser.A checked-in per-file coverage baseline that only ratchets up, for legacy codebases where one
minimum_coveragenumber does nothing and oneminimum_coverage_by_filenumber lets the single worst file set the ceiling for the whole policy.simplecov ratchetwrites.simplecov_baseline.ymlfrom the current report, one floor per file per measured criterion, and the exit check fails any listed file that drops below its own floor. Rewriting only ever tightens: files that improved get their floors raised, files that regressed keep the floors they are now below (and are named in the summary), entries for deleted files are pruned, and new files never get an entry, so they answer to the realminimum_per_filestandard (which files with an entry are exempt from, per criterion) rather than to a floor cut at whatever they launched with. The diff on the baseline file becomes the honest record of which direction the codebase moved, reviewable in the same PR as the change that moved it, the way.rubocop_todo.ymlrecords offenses. The issue left open whether a floor should be a percent or a count of uncovered lines, since a percent moves when a file is edited without any coverage change at all. Each floor stores both: the percent is the policy, and the missed count is the dampener, so a violation requires a lower percent and more misses together, and an edit that only reshuffles covered lines fails nothing. A hand-written bare-percent entry (lib/foo.rb: 41.2) is accepted and decided by percent alone until the next ratchet records its missed count, while a malformed baseline fails loudly rather than silently un-enforcing every floor it carried.--initdeliberately regenerates the file from scratch (new files added, floors reset),--dry-runprints without writing,--jsonemits the summary as data, and--baselinenames the file, defaulting to the project'sSimpleCov.baseline_file, which the command reads from.simplecovthe way the read-only commands readcoverage_dir. Baseline violations also land in coverage.json'serrorssection, under schema 1.2 (additive, with 1.1 staying frozen for pinned integrations). See #1268.maximum_missedandmaximum_missed_per_filecap the number of misses instead of demanding a ratio, per criterion: uncovered lines, branch arms, or methods, counted in the criterion's own units. The suite-wide cap is a burn-down number, because "12 uncovered lines left" stays meaningful as the codebase grows and shrinks and is the sentence a team driving to 100% actually says, while the equivalent percentage moves with every edit. The per-file cap says what a per-file percent minimum cannot: a 2,000-line file at 99% hides 20 misses while a 10-line file at 80% fails over 2, so the cap holds every file to the same absolute budget. Both are verbs in thecoverageblock (coverage(:line) { maximum_missed 12; maximum_missed_per_file 5 }, with the sameonly:per-path overrides asminimum_per_file) and flat helpers (SimpleCov.maximum_missed line: 12, branch: 3), a fractional or negative cap is a configuration error rather than a silent truncation, and files with a baseline entry are exempt from the per-file cap per covered criterion, the same fall-throughminimum_per_filehonors. Violations land in coverage.json'serrorssection asmaximum_missedandmaximum_missed_per_file, part of schema 1.2. See #1268.formats :html, :jsonselects the bundled formatters by name, so the most-typed constants in every README snippet (SimpleCov::Formatter::HTMLFormatterand friends) are no longer required for the common combinations.:html,:json,:simple, and:baselineare the built-in names, formatter classes and ready-built instances mix freely beside them for third-party and option-carrying formatters, an unknown name raises naming the built-ins, and the bare call reads back the configured chain the wayformattersdoes. The constant-spelledformatter/formattersforms are unchanged and equivalent.Entry filters are criterion-scoped
coverageverbs now:coverage(:branch) { ignore :implicit_else, :eval_generated }andcoverage :method, ignore: :eval_generatedreplaceignore_branches/ignore_methods, which had the criterion baked into their names the way the suffixed threshold verbs did. The flat setters are deprecated (warn-and-delegate, replacement named from their own arguments), with one behavior riding out the deprecation period: the coverage block enables the criterion it names, while the legacy setters record the filter without enabling.SimpleCov keeps a coverage history now, not just the last run. Every successful run appends an entry to
coverage/.history.json: the percentages for every measured criterion, recorded for the suite, for every group, and for every file, plus a timestamp and the branch and commit when the project is a git checkout. The file is bounded (history_limit, 100 entries by default, 0 disables), written atomically with the corrupt-file tolerance.last_run.jsonhas, and plain committable JSON so the trend can survive a clean CI checkout, while.last_run.jsonitself keeps working exactly as before. The history buys three things.simplecov historyprints the trend in the terminal as Unicode sparklines, one per measured criterion, with the run rows beneath, and--file PATHfollows one file's per-criterion trajectory the same way.drop_baseline :median/:branchletmaximum_coverage_dropcompare against the median of the recorded history, or against the newest recorded run on the current git branch, instead of against whatever ran most recently, so one run that dipped for an unrelated reason cannot quietly become the baseline the next run is judged against. And the history rides into coverage.json (and the HTML report's embedded data) as an optional top-levelhistoryarray under schema 1.2, so other tools can draw the trend from the report artifacts. See #1267.Coverage can be measured in production to find dead code.
require "simplecov/production"loads a standalone runtime (none of the reporting machinery, no formatters, no at-exit report) that is a no-op untilSimpleCov::Production.startis called explicitly: it measures:oneshot_linescoverage, whose report-first-hit-only semantics are what make the overhead viable on live traffic, and a background thread drains the runtime's table everyflush_intervalinto a pluggable sink instead of assuming one report per process at exit. Storage is the part a repository's coverage directory cannot be, so the sink is onestore(coverage)method receiving root-relative paths mapped to line numbers: it must union-merge (each process holds only a slice), tolerate duplicates, and raise on failure, which makes the runtime keep the delta and retry, bounded by a configurablemax_buffered_linesceiling whose drops self-heal for still-running code because a drained line re-reports on its next execution. A locking single-fileFileSinkships in the box; Redis or S3 implement the same method outside the gem.sample_rateduty-cycles measurement viaCoverage.suspend/resume(rates below 1.0 need Ruby 3.2), a test suite's running Coverage always wins overstart, forked workers re-startfrom the worker-boot hook and pick the inherited measurement back up, and configuration mistakes raise while environmental declines warn and no-op. Thensimplecov dead-code --production PATHcrosses the accumulated store with the test report, per line: run by both is normal, run in production but untested (--untested-in-production) is the highest-value place to add a test, tested but never run in production is possibly dead with only its own spec as a defender, and run by neither is dead. The default view prints the two deletion-candidate rows in the greppablepath:rangesform, marks a file whose every relevant line skipped production as(entire file), names the window the data spans because the window is the evidence, and--jsonemits every category as data. Documented in docs/Production.md. See #1271.Production coverage reaches the reports.
production_coverage "/path/to/production.json"names the store aSimpleCov::Productionsink accumulated, and the bundled formatters cross it with the test coverage: the HTML report's file list gains a sortable "Last Run in Production" column (ascending floats the files production never touched, the deletion candidates, to the top), each source view marks the cross's two actionable cells (covered code production never ran gets a gray gutter stripe, missed code production did run gets a teal stripe and a "runs in production" badge), the file header summarizes the ran share with the last-run date, and the legend explains both exactly when the section is present. Withsimplecov servethat report is a browsable production-coverage web UI.coverage.jsoncarries the same data as an optionalproductionsection (the window plus per-file lines andlast_seenstamps) under schema 1.3, additive as usual, so downstream tools get the cross as data. Backing both, the bundledFileSinknow stamps each file with the last drain that carried it (last_seen, optional on read so v1 stores and remote sinks that only fill the documented shape keep working, and honest recency because oneshot's clear-on-drain makes still-running code re-report every interval), and the runtime adds a fresh random share offlush_jitter(default a tenth offlush_interval) to every wait, so a fleet of workers booted together drifts apart instead of contending on the shared sink at the same instant forever. An unreadable store warns and the report generates without the section, because a missing night of production data should not fail the suite that measured the tests.simplecov dead-codereads the same stamps: rows gain a(last run 2026-08-03)annotation dating the store's last sighting of the file (on a dead or possibly dead row that means other lines of the file ran then, and no date means the window never saw the file at all),--jsonentries carry the full stamp aslast_seen, and rows from a stamp-less store print bare, exactly as before. The setting is also the CLI's default:dead-codefills in--productionfrom theproduction_coveragea project's.simplecovconfigures, the wayratchetreadsbaseline_file, so the configuration names the store once and everything that crosses reads it from there.deprecations :raiseturns every deprecated API into aSimpleCov::ConfigurationErrorinstead of a warning, so a project that has migrated can guard in CI against old spellings creeping back, and early adopters can hold themselves to the current surface as the configuration DSL evolves along its roadmap. The default staysdeprecations :warn, the error names the replacement the way the warning does, and there is deliberately no silencing mode, because a deprecation you cannot see is a migration you never make.Threshold scope is now a uniform
per:argument on thecoverageblock's verbs, instead of being baked into method names.minimum 80, per: :filesets the per-file default,minimum 100, per: "app/x.rb"(or a Regexp) overrides it for matching files, andminimum 95, per: group("Models")sets a group minimum, withmaximum_missedtaking the same targets for its per-file cap. One construct replaces three encodings (the bare verb, the_per_file/_per_groupsuffixes, and theonly:keyword), so any future threshold verb gets every scope by composition rather than by minting new names. The suffixed forms (minimum_per_file,minimum_per_group,maximum_missed_per_file, and the flatSimpleCov.maximum_missed_per_filesetter) are deprecated: they keep working and warn with the exactper:replacement built from their own arguments, and the olderminimum_coverage_by_file/minimum_coverage_by_groupdeprecation messages now suggest theper:grammar directly instead of the intermediate spelling. A scope the enforcement cannot check yet is refused loudly rather than silently stored, which today meansmaximum_missedrejectsper: group(...). The wider plan this is the first step of, covering the remaining matrix cells, the:evalpseudo-criterion, baseline unification, and the eventual single-surface 2.0 configuration, is written down in docs/Roadmap.md.SimpleCov::Formatter::BaselineFormatterauto-ratchets the per-file baseline at the end of every run, for teams that want floors to tighten continuously instead of by deliberatesimplecov ratchetinvocations. The semantics are exactly the CLI's (floors only tighten, regressed files keep the floors they are below and are named in the status line, deleted files are pruned, new files never get an entry), the file is rewritten only when a floor actually moved so an unchanged run leaves the working tree clean, and the exit checks still judge the run against the floors as they were when it started, which ratcheting cannot flip since it never loosens. See #1268.simplecov version(also--versionand-v) prints the installed gem version, so a bug report can name the release it came from without a trip throughgem list. It sits in the usage document like every other command, so the shell completions and the man page carry it too.Bugfixes
coverage.jsonin its own shape. The concurrent-overwrite check introduced in 1.1.0 reads the previous run'scoverage.jsonand parsed itsmeta.timestampexpecting the ISO 8601 string SimpleCov writes, but the file on disk is whatever wrote it last, and third-party formatters (undercover's among them) store an epoch integer there, which raisedTypeError: no implicit conversion of Integer into Stringand failed the HTML report on every run after the first. Epoch numbers now feed the check like ISO strings do, and any other timestamp shape disables the check for that file instead of taking the report down. See #1285.command_namesarray incoverage.json's meta (joinedcommand_nameunchanged), since splitting the joined string back apart would misread a run name that itself contains a comma. See #1284.oneshot_linesresults no longer crash the report on TruffleRuby, whoseCoveragemodule has noline_stub. The adapter that turns oneshot data into a line array asked for the stub unguarded, so a runtime without it raisedNoMethodError. It now starts from an empty array the way it already does for a vanished or unparseable file, and marks the recorded lines from there.v1.1.1Compare Source
==================
Enhancements
schemas/directory, dropping 32 KB unpacked from every install. Nothing read it at runtime: the JSON formatter points consumers at the canonical schema URL on GitHub, and the schema specs read from the repository.Bugfixes
at_exithooks run. rspec-conductor closes each worker's pipes as soon as the worker has sent its run summary, and emitting SimpleCov's status line probesColor.enabled?, whoseIO#tty?call raisedIOErroron the closed stream. That exception aborted the remaining exit tasks, so the HTML and JSON reports were written but the minimum and maximum coverage checks silently never ran, and neither.last_run.jsonnor the.report_stampdeferral marker was written. A closed stream now counts as not a tty, and the status line and the violation report are dropped rather than cancelling the checks that follow. rspec-conductor is also named in the parallel adapter documentation and covered end to end now, since it follows theTEST_ENV_NUMBERandPARALLEL_TEST_GROUPSconvention the generic adapter already recognizes. See #1156.SimpleCov.collateno longer depends on load order forCoverage.line_stub.SimulateCoverageandResultAdapterboth call it without requiring the coverage library. A normal run loads that library while starting tracking, but a collate-only process never starts tracking, so the constant resolved only by luck through a criterion-support check that happened to run first. Any reordering of that path would have turned into aNameErrorout ofSimpleCov.collate, so each file now requires what it uses.v1.1.0Compare Source
==================
Breaking Changes
simplecov report --jsonnow emits{"total": {...}, "groups": {...}}instead of flattening the overall"All Files"entry and configured groups into one object. The old shape silently overwrote the overall totals when a user group was also namedAll Files; the text report now labels that user sectionAll Files (group)as well.Ungroupedis now reserved for the implicit group of files that match no configured group. Defining an explicit group with that name previously caused SimpleCov to overwrite it during result processing and silently discard its matched files; rename such a group toOtheror another distinct label. Group names are also normalized when configured: aSymbolname (group :Models) now means the same group as itsStringspelling (sogroup :Ungroupedis rejected like the string form, and a symbol-named group can no longer produce a duplicate JSON key next to a string-named one), and a name that is neither aStringnor aSymbolraisesSimpleCov::ConfigurationError.index.html. The viewer's JavaScript and CSS are inlined into the compiled template at build time, and the coverage data is embedded at report time (with<escaped in the payload so embedded source text cannot terminate the surrounding<script>element), socoverage/contains justindex.htmlandcoverage.json. A single file can be mailed, uploaded as a non-zipped GitHub Actions run artifact (actions/upload-artifactwitharchive: false, viewable directly from the run page), or copied anywhere without sibling files, and the report can no longer be read mid-write in a torn state whereindex.html,coverage_data.js, andapplication.jscome from different runs — the whole report updates in one atomic rename. The sibling files the formatter previously wrote (coverage_data.js,application.js,application.css, and the three favicon PNGs) are gone; anything scripted against that layout should readcoverage.json(the sanctioned data artifact, unchanged) instead ofcoverage_data.js. Formatting also deletes those six names from the output directory when an earlier version left them there, so an upgraded project'scoverage/doesn't keep a stalecoverage_data.jsaround forsimplecov serveto serve. This restores single-file reports to the 1.0 line — the pre-1.0simplecov-htmlformatter offered them via theSIMPLECOV_INLINE_ASSETSenvironment variable, which the 1.0 client-side rendering rewrite dropped — and makes them the default and only mode, with no environment variable or configuration flag. See #1241.Enhancements
aria-pressed.simplecov servenow handles each connection on its own thread with a read timeout, so a stalled connection (browsers routinely open speculative sockets that send no bytes) no longer blocks every other request. It also works on JRuby and TruffleRuby, answers malformed request lines with a 400 instead of an empty response, and prints a bracketed URL for IPv6 hosts.docs/directory (Configuration, Parallelism, Formatters, CLI, Troubleshooting) alongside the changelogs, contributing guide, and code of conduct, with the issue template tucked into.github/. This changelog now lives atdocs/Changelog.mdand the gem'schangelog_urimetadata follows it. Nothing underdocs/ships in the gem, which also stops packaging the olddoc/*link lists. The alternate formatters catalog was rebuilt against RubyGems: twenty formatters join the twelve that were listed, organized by output type..resultset.jsonis now written as compact JSON instead of pretty-printed. It is a machine-read cache that every parallel worker rewrites wholesale, and pretty printing nearly doubled the bytes written, read back, and parsed on each store-merge round trip — on a 100,000-file project the file shrinks from 89MB to 51MB and serialization halves. Any JSON parser reads the compact form; pipe it throughjqif you need to inspect it by eye.SimpleCov.collatetakes a newprocesses:argument that fans the resultset merge out across that many forked worker processes. This addresses the wall clock of a large CI matrix's collate step, where the collating process reads, parses and folds hundredConfiguration
📅 Schedule: (in timezone Europe/Amsterdam)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.