Sha256: f872dff8723a2d7d971ebfa8a36d7ceb2f4793f7a52756c7f26d1ed9c2569052

Contents?: true

Size: 963 Bytes

Versions: 10

Compression:

Stored size: 963 Bytes

Contents

require 'colorize'

namespace :simplecov do
  task :check_coverage do
    ENV['COVERAGE'] ||= 'true'
    Rake::Task['spec'].invoke
  rescue SystemExit
    puts 'Code coverage analysis aborted, probably due to a previous test failure'.colorize(:red)
    raise
  end

  task :report do
    require 'simplecov'
    require 'simplecov-rcov'
    require 'simplecov-console'

    result_sets = Dir.glob('artifacts/simplecov/**/.resultset.json')
    SimpleCov.collate(result_sets) do
      minimum_coverage 100
      coverage_dir 'artifacts'

      if ENV['GENERATE_REPORTS']
        formatters = [
          SimpleCov::Formatter::Console,
          SimpleCov::Formatter::RcovFormatter
        ]
        formatter SimpleCov::Formatter::MultiFormatter.new(formatters)
      else
        formatter SimpleCov::Formatter::Console
      end
    end
  end
end

desc 'Run all specs in spec directory, with coverage'
task coverage: %w[simplecov:check_coverage simplecov:report]

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
berkeley_library-logging-0.2.7 rakelib/coverage.rake
berkeley_library-logging-0.2.6.2 rakelib/coverage.rake
berkeley_library-logging-0.2.6.1 rakelib/coverage.rake
berkeley_library-logging-0.2.6 rakelib/coverage.rake
berkeley_library-logging-0.2.5 rakelib/coverage.rake
berkeley_library-logging-0.2.4 rakelib/coverage.rake
berkeley_library-logging-0.2.3 rakelib/coverage.rake
berkeley_library-logging-0.2.2 rakelib/coverage.rake
berkeley_library-logging-0.2.1 rakelib/coverage.rake
berkeley_library-logging-0.2.0 rakelib/coverage.rake