Skip to content

Commit 5409e1a

Browse files
authored
🔀 Merge pull request #344 from ruby/make-simplecov-json-optional
Make simplecov-json as optional dependency
2 parents 5a0e5cb + 898ee6e commit 5409e1a

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

test/lib/helper.rb

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
require "simplecov"
22

33
# Cannot use ".simplecov" file: simplecov-json triggers a circular require.
4-
require "simplecov-json"
5-
SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new([
6-
SimpleCov::Formatter::HTMLFormatter,
7-
SimpleCov::Formatter::JSONFormatter,
8-
])
4+
begin
5+
require "simplecov-json"
6+
SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new([
7+
SimpleCov::Formatter::HTMLFormatter,
8+
SimpleCov::Formatter::JSONFormatter,
9+
])
10+
rescue LoadError
11+
# for `make test-bundled-gems` in ruby-core repository.
12+
# That task does not install C extension gem like json.
13+
end
914

1015
SimpleCov.start do
1116
command_name "Net::IMAP tests"

0 commit comments

Comments
 (0)