3

I'm using minitest-reporters and mini_backtrace gems with the settings from the Hartl tutorial. The output of my tests are way too long. The output includes a lot of sql and also lists each test.

enter image description here

Based on this question, the sql can be suppressed with:

ActiveRecord::Base.logger.level = 1

but how do I suppress the listing of each test? This is the output I'd like from the minitest-reporters gem's documentation:

enter image description here

How do I get a simple output like that?

Community
  • 1
  • 1
tquill
  • 279
  • 2
  • 12

1 Answers1

0

Please use the Logger constants instead of arbitrary numbers: Logger::INFO for instance. Also, the ActiveRecord log shouldn't appear on STDOUT, but go into a log file. You may replace ActiceRecord::Base.logger with Logger.new("log/test.log") for example.

If you don't have the expected output from minitest-reporters, you'll may want to force the default reporter:

Minitest::Reporters.use! Minitest::Reporters::DefaultReporter
Julien Portalier
  • 2,959
  • 1
  • 20
  • 22
  • Julien, I updated my original question with an excerpt picture of my minitest output. Assuming I haven't changed any defaults in Rails (I didn't think I did), is it supposed to be that long and include all of that information? If not, what did I inadvertently change? I'd rather not change defaults (like ActiveRecord::Base.logger) if I don't have to. – tquill Jun 21 '15 at 19:33
  • I'm not sure why I had to add this line, but adding `config.log_level = :error` in `test.rb` fixed it. Other repos which I've cloned don't have this line and have minimal testing output... so I'm not sure if what I've done differently. – tquill Jun 21 '15 at 21:02
  • I thought you were using AR without Rails. Your actual problem is that something is messing your `Rails.logger`: all the logs should be going to `log/test.log` but they are instead pushed to STDOUT for some reason. Try to remove the minitest-reporters and mini_backtrace and verify what happens then. Maybe loading them in another order in `test_helper.rb` like before or after Rails has loaded can resolve the issue. – Julien Portalier Jun 22 '15 at 06:27