generated from rubocop-lts/rubocop-ruby2_2
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.simplecov
78 lines (69 loc) · 2.16 KB
/
.simplecov
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# frozen_string_literal: true
# To get coverage
# On Local, default (HTML) output coverage is turned on with Ruby 2.7+:
# bundle exec rspec spec
# On Local, all output formats with Ruby 3.0+:
# COVER_ALL=true bundle exec rspec spec
#
# On CI, all output formats, but coverage only runs for the coverage workflow.
# The ENV variable CI is always set,
# and COVER_ALL, and CI_CODECOV, are set in the coverage.yml workflow only,
# so coverage only runs in that workflow, and outputs all formats.
#
if RUN_COVERAGE
SimpleCov.start do
enable_coverage :branch
primary_coverage :branch
track_files "**/*.rb"
# Filters (skip these paths for coverage tracking)
add_filter [
%r{^/bin/},
%r{^/certs/},
%r{^/checksums/},
%r{^/config/},
%r{^/docs/},
%r{^/features/},
%r{^/gemfiles/},
%r{^/pkg/},
%r{^/results/},
%r{^/sig/},
%r{^/spec/},
%r{^/src/},
%r{^/test/},
%r{^/vendor/},
"railtie.rb",
]
# Setup Coverage Dir
SimpleCov.coverage_dir("coverage")
if ALL_FORMATTERS
require "simplecov-rcov"
require "simplecov-json"
require "simplecov-lcov"
require "simplecov-cobertura"
command_name "#{ENV.fetch(
"GITHUB_WORKFLOW",
nil,
)} Job #{ENV.fetch("GITHUB_RUN_ID", nil)}:#{ENV.fetch("GITHUB_RUN_NUMBER", nil)}"
SimpleCov::Formatter::LcovFormatter.config do |c|
c.report_with_single_file = true
c.single_report_path = "coverage/lcov.info"
end
SimpleCov.formatters = [
SimpleCov::Formatter::HTMLFormatter,
SimpleCov::Formatter::CoberturaFormatter, # XML for Jenkins
SimpleCov::Formatter::RcovFormatter, # For Hudson
SimpleCov::Formatter::LcovFormatter,
SimpleCov::Formatter::JSONFormatter, # For CodeClimate
]
else
command_name "RSpec"
formatter SimpleCov::Formatter::HTMLFormatter
end
# Use Merging (merges RSpec + Cucumber Test Results)
SimpleCov.use_merging(true)
SimpleCov.merge_timeout(3600)
minimum_coverage(line: 100, branch: 100)
end
else
puts "Not running coverage on #{RUBY_VERSION}-#{RUBY_ENGINE}"
end