Skip to content

Fix coverage by making sure isolated specs have SimpleCov.command_name #2629

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .github/workflows/sentry_delayed_job_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ jobs:
- ruby_version: "3.2"
options:
rubyopt: "--enable-frozen-string-literal --debug=frozen-string-literal"
- ruby_version: "3.2"
options:
codecov: 1
exclude:
# Because Rails 7.0 currently doesn't work with Ruby head
# LoadError:
Expand All @@ -63,7 +60,6 @@ jobs:
run: bundle exec rake

- name: Upload Coverage
if: ${{ matrix.options.codecov }}
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
3 changes: 3 additions & 0 deletions sentry-rails/spec/versioned/2.7/activejob_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

require "spec_helper"

# isolated tests need a SimpleCov name otherwise they will overwrite coverage
SimpleCov.command_name "RSpecVersioned_2.7_ActiveJob"

RSpec.describe "ActiveJob integration", type: :job do
before do
make_basic_app
Expand Down
2 changes: 1 addition & 1 deletion sentry-ruby/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ RSpec::Core::RakeTask.new(:spec).tap do |task|
end

task :isolated_specs do
Dir["spec/isolated/*"].each do |file|
Dir["spec/isolated/**/*_spec.rb"].each do |file|
sh "bundle exec rspec #{file}"
end
end
Expand Down
3 changes: 2 additions & 1 deletion sentry-ruby/spec/isolated/init.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# frozen_string_literal: true

require_relative "../spec_helper"
require "sentry-ruby"
require "sentry/test_helper"

Sentry.init do |config|
config.dsn = Sentry::TestHelper::DUMMY_DSN
Expand Down
3 changes: 2 additions & 1 deletion sentry-ruby/spec/isolated/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

require_relative "../spec_helper"

SimpleCov.command_name "RSpecIsolated"
# isolated tests need a SimpleCov name otherwise they will overwrite coverage
SimpleCov.command_name "RSpecIsolatedInit"

RSpec.describe Sentry do
context "works within a trap context", when: { ruby_engine?: "ruby" } do
Expand Down
3 changes: 2 additions & 1 deletion sentry-ruby/spec/isolated/puma_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
# Because puma doesn't have any dependency, if Rack is not installed the entire test won't work
return if ENV["RACK_VERSION"] == "0"

SimpleCov.command_name "RSpecIsolated"
# isolated tests need a SimpleCov name otherwise they will overwrite coverage
SimpleCov.command_name "RSpecIsolatedPuma"

RSpec.describe Puma::Server do
class TestServer
Expand Down
Loading