Skip to content

Commit

Permalink
Add simplecov (#760)
Browse files Browse the repository at this point in the history
  • Loading branch information
zachgoll committed May 17, 2024
1 parent ac46c0c commit 22e6919
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,5 @@ compose-dev.yaml

# Ignore GCP keyfile
gcp-storage-keyfile.json

coverage
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,5 @@ group :test do
gem "vcr"
gem "webmock"
gem "climate_control"
gem "simplecov", require: false
end
8 changes: 8 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ GEM
debug (1.9.2)
irb (~> 1.10)
reline (>= 0.3.8)
docile (1.4.0)
dotenv (3.1.2)
dotenv-rails (3.1.2)
dotenv (= 3.1.2)
Expand Down Expand Up @@ -399,6 +400,12 @@ GEM
sentry-ruby (5.17.3)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.4)
smart_properties (1.17.0)
sorbet-runtime (0.5.11383)
stackprof (0.2.26)
Expand Down Expand Up @@ -493,6 +500,7 @@ DEPENDENCIES
selenium-webdriver
sentry-rails
sentry-ruby
simplecov
stackprof
stimulus-rails
tailwindcss-rails
Expand Down
18 changes: 18 additions & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
if ENV["COVERAGE"]
require "simplecov"
SimpleCov.start "rails" do
enable_coverage :branch
end
end

# Test ENV setup:
# By default, all features should be disabled
# Use the `with_env_overrides` helper to enable features for individual tests
Expand Down Expand Up @@ -28,6 +35,17 @@ class TestCase
# Run tests in parallel with specified workers
parallelize(workers: :number_of_processors)

# https://github.com/simplecov-ruby/simplecov/issues/718#issuecomment-538201587
if ENV["COVERAGE"]
parallelize_setup do |worker|
SimpleCov.command_name "#{SimpleCov.command_name}-#{worker}"
end

parallelize_teardown do |worker|
SimpleCov.result
end
end

# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
fixtures :all

Expand Down

0 comments on commit 22e6919

Please sign in to comment.