Skip to content
This repository was archived by the owner on May 9, 2025. It is now read-only.

Commit d903e6c

Browse files
committed
Allow building with newer simplecov versions
1 parent 8233cda commit d903e6c

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ jobs:
3636
- name: Run tests
3737
run: bundle exec rake test
3838
- name: Submit code coverage results
39-
uses: paambaati/[email protected]
39+
uses: paambaati/[email protected]
40+
if: matrix.ruby-version != '2.1'
4041
env:
4142
CC_TEST_REPORTER_ID: ${{ secrets.CODECLIMATE_REPO_TOKEN }}
4243

discid.gemspec

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,10 @@ Gem::Specification.new do |spec|
3131
spec.add_development_dependency "yard"
3232
spec.add_development_dependency "redcarpet" if not RUBY_PLATFORM == "java"
3333
spec.add_development_dependency "test-unit"
34-
spec.add_development_dependency "simplecov", "< 0.18"
34+
35+
# The code coverage is only supported for Ruby >= 2.4
36+
if (RUBY_VERSION.split('.').map{|s|s.to_i} <=> [2, 4, 0]) >= 0
37+
spec.add_development_dependency "simplecov"
38+
spec.add_development_dependency "simplecov_json_formatter"
39+
end
3540
end

test/helper.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (C) 2013-2014 Philipp Wolfer
1+
# Copyright (C) 2013-2014, 2025 Philipp Wolfer
22
#
33
# This program is free software: you can redistribute it and/or modify
44
# it under the terms of the GNU Lesser General Public License as published by
@@ -15,10 +15,12 @@
1515

1616
begin
1717
require 'simplecov'
18+
require "simplecov_json_formatter"
1819

20+
SimpleCov.formatter = SimpleCov::Formatter::JSONFormatter
1921
SimpleCov.start do
2022
add_filter "/test/"
2123
end
2224
rescue LoadError
23-
puts 'WARNING: codeclimate-test-reporter not available, no code coverage reported.'
25+
puts 'WARNING: simplecov not available, no code coverage reported.'
2426
end

0 commit comments

Comments
 (0)