-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Ole Morten Amundsen edited this page Oct 5, 2018
·
6 revisions
With SIMPLECOV simplecov -- by a grateful user
To print the simplecov report at the end only, not for each thread.
spec_helper.rb
if ENV['COVERAGE'] == 'true'
require 'simplecov'
require 'simplecov-console'
SimpleCov.formatter = SimpleCov::Formatter::Console
SimpleCov.start 'rails'
if ENV['TEST_ENV_NUMBER'] # parallel specs
SimpleCov.at_exit do
result = SimpleCov.result
result.format! if ParallelTests.number_of_running_processes <= 1
end
end
end
RSpec.configure do |config|
...
gems:
group :test do
gem 'simplecov'
gem 'simplecov-console'
Extras: Reduce noise in the output:
spec_helper.rb or rails_helper.rb
RSpec.configure do |config|
...
# mute noise for parallel tests
config.silence_filter_announcements = true if ENV['TEST_ENV_NUMBER']
!! Add your own experience / gotchas !!