File: simplecov_helper.rb

package info (click to toggle)
ruby-minitest-hooks 1.5.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 156 kB
  • sloc: ruby: 600; makefile: 4
file content (27 lines) | stat: -rw-r--r-- 703 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
require 'simplecov'

SimpleCov.instance_exec do
  enable_coverage :branch
  add_filter "/spec/"
  add_group('Missing'){|src| src.covered_percent < 100}
  add_group('Covered'){|src| src.covered_percent == 100}
  enable_for_subprocesses true

  at_fork do |pid|
    command_name "#{SimpleCov.command_name} (subprocess: #{pid})"
    self.print_error_status = false
    formatter SimpleCov::Formatter::SimpleFormatter
    minimum_coverage 0
    start
  end

  if ENV['COVERAGE'] == 'subprocess'
    ENV.delete('COVERAGE')
    command_name 'spawn'
    at_fork.call(Process.pid)
  else
    ENV['COVERAGE'] = 'subprocess'
    ENV['RUBYOPT'] = "#{ENV['RUBYOPT']} -r ./spec/simplecov_helper"
    start
  end
end