Skip to content

Commit 1c8d06b

Browse files
add SimpleCov
1 parent 2430e71 commit 1c8d06b

4 files changed

Lines changed: 27 additions & 2 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,4 @@
3232

3333
# Ignore master key for decrypting credentials and more.
3434
/config/master.key
35+
coverage/

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ group :development do
5757
end
5858

5959
group :test do
60+
gem 'simplecov', require: false
6061
# Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
6162
gem "capybara"
6263
gem "selenium-webdriver"

Gemfile.lock

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ GEM
102102
debug (1.10.0)
103103
irb (~> 1.10)
104104
reline (>= 0.3.8)
105+
docile (1.4.1)
105106
dotenv (3.1.8)
106107
drb (2.2.3)
107108
ed25519 (1.4.0)
@@ -288,6 +289,12 @@ GEM
288289
rexml (~> 3.2, >= 3.2.5)
289290
rubyzip (>= 1.2.2, < 3.0)
290291
websocket (~> 1.0)
292+
simplecov (0.22.0)
293+
docile (~> 1.1)
294+
simplecov-html (~> 0.11)
295+
simplecov_json_formatter (~> 0.1)
296+
simplecov-html (0.13.1)
297+
simplecov_json_formatter (0.1.4)
291298
solid_cable (3.0.8)
292299
actioncable (>= 7.2)
293300
activejob (>= 7.2)
@@ -373,6 +380,7 @@ DEPENDENCIES
373380
rails (~> 8.0.2)
374381
rubocop-rails-omakase
375382
selenium-webdriver
383+
simplecov
376384
solid_cable
377385
solid_cache
378386
solid_queue

test/test_helper.rb

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
require "simplecov"
2+
3+
SimpleCov.start "rails" do
4+
use_merging true
5+
merge_timeout 3600
6+
enable_coverage :branch
7+
add_filter "/test/"
8+
add_filter "/config/"
9+
end
10+
111
ENV["RAILS_ENV"] ||= "test"
212
require_relative "../config/environment"
313
require "rails/test_help"
@@ -7,6 +17,13 @@ module ActiveSupport
717
class TestCase
818
# Run tests in parallel with specified workers
919
parallelize(workers: :number_of_processors)
20+
parallelize_setup do |worker|
21+
SimpleCov.command_name "#{SimpleCov.command_name}[#{worker}]"
22+
end
23+
24+
parallelize_teardown do |worker|
25+
SimpleCov.result
26+
end
1027

1128
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
1229
fixtures :all
@@ -16,8 +33,6 @@ class TestCase
1633
end
1734

1835

19-
20-
2136
class ActionDispatch::IntegrationTest
2237
include SignInHelper
2338
end

0 commit comments

Comments
 (0)