Class: CliCoverage

Inherits:
Object
  • Object
show all
Defined in:
lib/cli_coverage.rb

Class Method Summary collapse

Class Method Details

.conditionally_activateObject


2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/cli_coverage.rb', line 2

def self.conditionally_activate
  return if !ENV["COVERAGE"]

  require "simplecov"

  # Collect coverage separately
  SimpleCov.command_name "#{ENV['COVERAGE']} #{ARGV.join(' ')} coverage"

  # Silence output
  SimpleCov.formatter = SimpleCov::Formatter::SimpleFormatter
  SimpleCov.print_error_status = false

  # Ensure SimpleCov doesn't filter out all out code
  project_root = File.expand_path("..", __dir__)
  SimpleCov.root project_root
end