Skip to content

Commit de9f210

Browse files
authored
Fix coverage by making sure isolated specs have SimpleCov.command_name (#2629)
1 parent c509ce1 commit de9f210

File tree

6 files changed

+10
-8
lines changed

6 files changed

+10
-8
lines changed

.github/workflows/sentry_delayed_job_test.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ jobs:
3535
- ruby_version: "3.2"
3636
options:
3737
rubyopt: "--enable-frozen-string-literal --debug=frozen-string-literal"
38-
- ruby_version: "3.2"
39-
options:
40-
codecov: 1
4138
exclude:
4239
# Because Rails 7.0 currently doesn't work with Ruby head
4340
# LoadError:
@@ -63,7 +60,6 @@ jobs:
6360
run: bundle exec rake
6461

6562
- name: Upload Coverage
66-
if: ${{ matrix.options.codecov }}
6763
uses: codecov/codecov-action@v5
6864
with:
6965
token: ${{ secrets.CODECOV_TOKEN }}

sentry-rails/spec/versioned/2.7/activejob_spec.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
require "spec_helper"
44

5+
# isolated tests need a SimpleCov name otherwise they will overwrite coverage
6+
SimpleCov.command_name "RSpecVersioned_2.7_ActiveJob"
7+
58
RSpec.describe "ActiveJob integration", type: :job do
69
before do
710
make_basic_app

sentry-ruby/Rakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ RSpec::Core::RakeTask.new(:spec).tap do |task|
1414
end
1515

1616
task :isolated_specs do
17-
Dir["spec/isolated/*"].each do |file|
17+
Dir["spec/isolated/**/*_spec.rb"].each do |file|
1818
sh "bundle exec rspec #{file}"
1919
end
2020
end

sentry-ruby/spec/isolated/init.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# frozen_string_literal: true
22

3-
require_relative "../spec_helper"
3+
require "sentry-ruby"
4+
require "sentry/test_helper"
45

56
Sentry.init do |config|
67
config.dsn = Sentry::TestHelper::DUMMY_DSN

sentry-ruby/spec/isolated/init_spec.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
require_relative "../spec_helper"
44

5-
SimpleCov.command_name "RSpecIsolated"
5+
# isolated tests need a SimpleCov name otherwise they will overwrite coverage
6+
SimpleCov.command_name "RSpecIsolatedInit"
67

78
RSpec.describe Sentry do
89
context "works within a trap context", when: { ruby_engine?: "ruby" } do

sentry-ruby/spec/isolated/puma_spec.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
# Because puma doesn't have any dependency, if Rack is not installed the entire test won't work
77
return if ENV["RACK_VERSION"] == "0"
88

9-
SimpleCov.command_name "RSpecIsolated"
9+
# isolated tests need a SimpleCov name otherwise they will overwrite coverage
10+
SimpleCov.command_name "RSpecIsolatedPuma"
1011

1112
RSpec.describe Puma::Server do
1213
class TestServer

0 commit comments

Comments
 (0)