Skip to content

test/test__helper.rb starts SimpleCov with no minimum_coverage, so the build accepts arbitrarily low coverage #232

Description

@edmoffo

test/test__helper.rb:8-12 runs:

require 'simplecov'
SimpleCov.start

require 'simplecov-cobertura'
SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter

The block sets up coverage measurement and the Cobertura output formatter but never calls SimpleCov.minimum_coverage, SimpleCov.minimum_coverage_by_file, or SimpleCov.refuse_coverage_drop. SimpleCov defaults to reporting only; it does not fail the build when coverage falls below a threshold because there is no threshold configured.

The consequence is that bundle exec rake reports a green build even when a contributor lands a change that drops line coverage close to zero. Future swarms generated from this template inherit the same blind spot: the Cobertura XML lands under coverage/, but nothing in CI reads it back and gates merges on it.

A minimal fix is one line after SimpleCov.start, for example SimpleCov.minimum_coverage 95, set to the level the current suite already meets. A second line, SimpleCov.refuse_coverage_drop, prevents slow erosion when contributors add code without adding tests.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions