Sha256: c4ecedb2d2e62f677f1ee3b3c73dd37d737cc40c651f135b2dfeb2cad8039778

Contents?: true

Size: 1.13 KB

Versions: 4

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true

coverage = if ENV["COVERAGE"]
             ENV["COVERAGE"] == "true"
           else
             # heuristics: enable for interactive builds (but not in OBS)
             ENV["DISPLAY"]
           end

if coverage
  require "simplecov"
  SimpleCov.root File.expand_path("..", __dir__)

  # do not cover specs
  SimpleCov.add_filter "_spec.rb"
  # do not cover the activesupport helpers
  SimpleCov.add_filter "/core_ext/"
  # measure all if/else branches on a line
  SimpleCov.enable_coverage :branch

  SimpleCov.start

  # additionally use the LCOV format for on-line code coverage reporting at CI
  if ENV["COVERAGE_LCOV"] == "true"
    require "simplecov-lcov"

    SimpleCov::Formatter::LcovFormatter.config do |c|
      c.report_with_single_file = true
      # this is the default Coveralls GitHub Action location
      # https://github.com/marketplace/actions/coveralls-github-action
      c.single_report_path = "coverage/lcov.info"
    end

    SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new [
      SimpleCov::Formatter::HTMLFormatter,
      SimpleCov::Formatter::LcovFormatter
    ]
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ruby-dbus-0.24.0 spec/coverage_helper.rb
ruby-dbus-0.23.1 spec/coverage_helper.rb
ruby-dbus-0.23.0.beta2 spec/coverage_helper.rb
ruby-dbus-0.23.0.beta1 spec/coverage_helper.rb