Skip to content

Commit

Permalink
make coverage run conditionally
Browse files Browse the repository at this point in the history
  • Loading branch information
markburns committed Jul 3, 2024
1 parent 49e7312 commit 701826d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
2 changes: 2 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# frozen_string_literal: true

require "debug"

require "./spec/support/coverage"

require "interactify"

if Interactify.sidekiq?
Expand Down
32 changes: 17 additions & 15 deletions spec/support/coverage.rb
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
# frozen_string_literal: true

require "simplecov"
require "simplecov-json"
if ENV["COVERAGE"]
require "simplecov"
require "simplecov-json"

SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new([
SimpleCov::Formatter::HTMLFormatter,
SimpleCov::Formatter::JSONFormatter
])
SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new([
SimpleCov::Formatter::HTMLFormatter,
SimpleCov::Formatter::JSONFormatter
])

SimpleCov.start do
add_filter "/spec/"
add_filter(/_spec\.rb$/) # This line excludes all files ending with _spec.rb
SimpleCov.start do
add_filter "/spec/"
add_filter(/_spec\.rb$/) # This line excludes all files ending with _spec.rb

add_group "Sidekiq jobs" do |src_file|
src_file.project_filename =~ %r{lib/interactify/async} && src_file.filename !~ /_spec\.rb/
end
add_group "Sidekiq jobs" do |src_file|
src_file.project_filename =~ %r{lib/interactify/async} && src_file.filename !~ /_spec\.rb/
end

add_group "Wiring", "lib/interactify/wiring"
add_group "RSpec matchers", "lib/interactify/rspec_matchers"
add_group "Wiring", "lib/interactify/wiring"
add_group "RSpec matchers", "lib/interactify/rspec_matchers"

coverage_dir "coverage/#{ENV.fetch('RUBY_VERSION', nil)}-#{ENV.fetch('APPRAISAL', nil)}"
coverage_dir "coverage/#{ENV.fetch('RUBY_VERSION', nil)}-#{ENV.fetch('APPRAISAL', nil)}"
end
end

0 comments on commit 701826d

Please sign in to comment.