@@ -20,35 +20,43 @@ def verify_contents(subject, title, expected_lines)
20
20
module_path = File . join ( fixture_path , 'modules' )
21
21
22
22
module_path = [ module_path , env_module_path ] . join ( File ::PATH_SEPARATOR ) if env_module_path
23
+
23
24
if ENV [ 'SIMPLECOV' ] == 'yes'
24
25
begin
25
26
require 'simplecov'
26
27
require 'simplecov-console'
27
-
28
- SimpleCov . formatters = [
29
- SimpleCov ::Formatter ::HTMLFormatter ,
30
- SimpleCov ::Formatter ::Console
31
- ]
32
-
33
- SimpleCov . start do
34
- track_files 'lib/**/*.rb'
35
- add_filter '/spec'
36
-
37
- # do not track vendored files
38
- add_filter '/vendor'
39
- add_filter '/.vendor'
40
-
41
- # do not track gitignored files
42
- # this adds about 4 seconds to the coverage check
43
- # this could definitely be optimized
44
- add_filter do |f |
45
- # system returns true if exit status is 0, which with git-check-ignore means file is ignored
46
- system ( "git check-ignore --quiet #{ f . filename } " )
47
- end
48
- end
49
28
rescue LoadError
50
29
raise 'Add the simplecov and simplecov-console gems to Gemfile to enable this task'
51
30
end
31
+
32
+ SimpleCov . formatters = [
33
+ SimpleCov ::Formatter ::HTMLFormatter ,
34
+ SimpleCov ::Formatter ::Console
35
+ ]
36
+
37
+ begin
38
+ require 'codecov'
39
+ SimpleCov . formatters << SimpleCov ::Formatter ::Codecov
40
+ rescue LoadError
41
+ # continue without codecov, we could warn here but we wont to avoid if possible
42
+ end
43
+
44
+ SimpleCov . start do
45
+ track_files 'lib/**/*.rb'
46
+ add_filter '/spec'
47
+
48
+ # do not track vendored files
49
+ add_filter '/vendor'
50
+ add_filter '/.vendor'
51
+
52
+ # do not track gitignored files
53
+ # this adds about 4 seconds to the coverage check
54
+ # this could definitely be optimized
55
+ add_filter do |f |
56
+ # system returns true if exit status is 0, which with git-check-ignore means file is ignored
57
+ system ( "git check-ignore --quiet #{ f . filename } " )
58
+ end
59
+ end
52
60
end
53
61
54
62
# Add all spec lib dirs to LOAD_PATH
0 commit comments