Skip to content

Commit 73d3705

Browse files
committed
Coverage
1 parent 3796c81 commit 73d3705

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,14 @@ jobs:
3131
ruby-version: ${{ matrix.ruby }}
3232
bundler-cache: true
3333
- run: bundle exec standardrb
34-
- run: COVERAGE=0 TEST_NODE_PARITY=1 bundle exec rake test
34+
- name: Run tests with coverage
35+
env:
36+
COVERAGE: 1
37+
TEST_NODE_PARITY: 1
38+
run: bundle exec rake test
39+
- name: Upload coverage to Codecov
40+
uses: codecov/codecov-action@v3
41+
with:
42+
token: ${{ secrets.CODECOV_TOKEN }}
43+
files: ./coverage/coverage.json
44+
fail_ci_if_error: true

test/test_helper.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@
33

44
if ENV["COVERAGE"] != "0"
55
require "simplecov"
6-
SimpleCov.start { add_filter "/test/" }
6+
SimpleCov.start do
7+
add_filter "/test/"
8+
enable_coverage :branch
9+
10+
# Use JSON formatter for Codecov
11+
SimpleCov.formatter = SimpleCov::Formatter::JSONFormatter if ENV["CI"]
12+
end
713
end
814

915
require "minitest/autorun"

0 commit comments

Comments
 (0)