simplecov icon indicating copy to clipboard operation
simplecov copied to clipboard

Is it possible to disable the "Coverage report generated..." message?

Open dogweather opened this issue 3 years ago • 2 comments

I couldn't find a list of config options.

This long line of text is unnecessary noise for my configuration.

dogweather avatar May 31 '21 06:05 dogweather

I disabled this with an at_exit block

SimpleCov.at_exit do
  original_file_descriptor = $stdout
  $stdout.reopen("/dev/null")
  SimpleCov.result.format!
  $stdout.reopen(original_file_descriptor)
end

dillonhafer avatar Jul 28 '21 12:07 dillonhafer

@dillonhafer that trick works great. I ended up adding a simplecov_helper.rb file and requiring it from my spec_helper.rb to keep things tidy. With parallel_tests on a 10 core system my stdout is much cleaner.


spec/spec_helper.rb

-require 'simplecov'
-SimpleCov.start
+require 'simplecov_helper'

spec/simplecov_helper.rb

require 'simplecov'
SimpleCov.start

# Don't print the "Coverage report generated for..." messages
# https://github.com/simplecov-ruby/simplecov/issues/992
SimpleCov.at_exit do
  original_file_descriptor = $stdout
  $stdout.reopen("/dev/null")
  SimpleCov.result.format!
  $stdout.reopen(original_file_descriptor)
end

duffyjp avatar Aug 29 '22 14:08 duffyjp