-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.simplecov
More file actions
78 lines (63 loc) · 1.78 KB
/
.simplecov
File metadata and controls
78 lines (63 loc) · 1.78 KB
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
require 'pathname'
require 'simplecov'
require 'simplecov-console'
module SilenceFormatting
def silent
return unless block_given?
stdout, $stdout = $stdout, StringIO.new
yield
ensure
$stdout = stdout
end
def format(result)
silent { super }
end
end
class SilentHTMLFormatter < SimpleCov::Formatter::HTMLFormatter
include SilenceFormatting
end
class SilentConsoleFormatter < SimpleCov::Formatter::Console
include SilenceFormatting
end
def formatters(silent = false)
[].tap do |f|
if silent
f << SilentHTMLFormatter << SilentConsoleFormatter
else
f << SimpleCov::Formatter::HTMLFormatter << SimpleCov::Formatter::Console
end
begin
require 'coveralls'
f << Coveralls::SimpleCov::Formatter
rescue LoadError # rubocop:disable Lint/HandleExceptions
end
end
end
def multi_formatter(silent = false)
SimpleCov::Formatter::MultiFormatter.new(formatters(silent))
end
SimpleCov.profiles.define 'rbexec_base' do
load_profile 'bundler_filter'
add_group 'Sources', %w[bin lib]
add_group 'Tests', 'spec'
add_filter 'tmp*'
add_filter '/spec/fixtures/'
Pathname.new(__FILE__).parent.tap do |r|
add_filter do |src|
Pathname.new(src.filename).relative_path_from(r).each_filename.any? { |e| e.start_with? '.' }
end
root r
coverage_dir r + 'coverage'
end
end
SimpleCov.profiles.define 'rbexec_rspec' do
load_profile 'rbexec_base'
formatter multi_formatter
end
SimpleCov.profiles.define 'rbexec_bashcov' do
load_profile 'rbexec_base'
command_name ENV.fetch('BASHCOV_COMMAND_NAME', $0)
formatter multi_formatter(true)
Coveralls::Output.silent = true if defined? Coveralls::Output
end
SimpleCov.load_profile 'rbexec_bashcov' if ENV.key? 'BASHCOV_COMMAND_NAME'