Skip to content
This repository was archived by the owner on Mar 15, 2022. It is now read-only.

Commit cfd0933

Browse files
committed
tests: make simplecov/coveralls optional
If we do not have SimpleCov or Coveralls installed, we should be able to continue with the rest of the test suite. This allows the tests to run outside of Bundler if SimpleCov or Coveralls are not installed.
1 parent ae2e618 commit cfd0933

File tree

1 file changed

+23
-19
lines changed

1 file changed

+23
-19
lines changed

test/test_helper.rb

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,27 @@
11
unless defined?(JRUBY_VERSION)
2-
require 'simplecov'
3-
require 'coveralls'
4-
5-
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
6-
SimpleCov::Formatter::HTMLFormatter,
7-
Coveralls::SimpleCov::Formatter
8-
]
9-
10-
SimpleCov.start do
11-
project_name 'thread_safe'
12-
13-
add_filter '/examples/'
14-
add_filter '/pkg/'
15-
add_filter '/test/'
16-
add_filter '/tasks/'
17-
add_filter '/yard-template/'
18-
add_filter '/yardoc/'
19-
20-
command_name 'Mintest'
2+
begin
3+
require 'simplecov'
4+
require 'coveralls'
5+
6+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
7+
SimpleCov::Formatter::HTMLFormatter,
8+
Coveralls::SimpleCov::Formatter
9+
]
10+
11+
SimpleCov.start do
12+
project_name 'thread_safe'
13+
14+
add_filter '/examples/'
15+
add_filter '/pkg/'
16+
add_filter '/test/'
17+
add_filter '/tasks/'
18+
add_filter '/yard-template/'
19+
add_filter '/yardoc/'
20+
21+
command_name 'Mintest'
22+
end
23+
rescue LoadError
24+
warn "warning: simplecov/coveralls gems not found; skipping coverage"
2125
end
2226
end
2327

0 commit comments

Comments
 (0)