burke / zeus

Boot any rails app in under a second.
MIT License
3.33k stars 231 forks source link

Test output #354

Closed jeremywrowe closed 9 years ago

jeremywrowe commented 11 years ago

This is more of a question than a defect. Is it possible to suppress backtraces when running tests, the backtrace output is lengthy and hides the test failures.

perldork commented 11 years ago

If you are using rspec, you can customize the rspec output via options in an .rspec file in the base directory of your project.

On Mon, May 27, 2013 at 7:55 PM, Jeremy Rowe notifications@github.comwrote:

This is more of a question than a defect. Is it possible to suppress backtraces when running tests, the backtrace output is lengthy and hides the test failures.

— Reply to this email directly or view it on GitHubhttps://github.com/burke/zeus/issues/354 .

jeremywrowe commented 11 years ago

Let me provide an example of what I am talking about

With zeus:

Failures:

  1) fail
     Failure/Error: it { fail "boom" }
     RuntimeError:
       boom
     # ./spec/fail.rb:2:in `block (2 levels) in <top (required)>'
     # /Users/jrowe/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/rspec-core-2.13.1/lib/rspec/core/example.rb:114:in `instance_eval'
     # /Users/jrowe/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/rspec-core-2.13.1/lib/rspec/core/example.rb:114:in `block in run'
     # /Users/jrowe/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/rspec-core-2.13.1/lib/rspec/core/example.rb:254:in `with_around_each_hooks'
     # /Users/jrowe/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/rspec-core-2.13.1/lib/rspec/core/example.rb:111:in `run'
     # /Users/jrowe/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/rspec-core-2.13.1/lib/rspec/core/example_group.rb:390:in `block in run_examples'
     # /Users/jrowe/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/rspec-core-2.13.1/lib/rspec/core/example_group.rb:386:in `map'
     # /Users/jrowe/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/rspec-core-2.13.1/lib/rspec/core/example_group.rb:386:in `run_examples'
     # /Users/jrowe/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/rspec-core-2.13.1/lib/rspec/core/example_group.rb:371:in `run'
     # /Users/jrowe/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/rspec-core-2.13.1/lib/rspec/core/command_line.rb:28:in `block (2 levels) in run'
     # /Users/jrowe/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/rspec-core-2.13.1/lib/rspec/core/command_line.rb:28:in `map'
     # /Users/jrowe/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/rspec-core-2.13.1/lib/rspec/core/command_line.rb:28:in `block in run'
     # /Users/jrowe/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/rspec-core-2.13.1/lib/rspec/core/reporter.rb:34:in `report'
     # /Users/jrowe/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/rspec-core-2.13.1/lib/rspec/core/command_line.rb:25:in `run'
....

without zeus:

chargify/chargify [fix_jasmine] » rspec spec/fail.rb
F

Failures:

  1) fail
     Failure/Error: it { fail "boom" }
     RuntimeError:
       boom
     # ./spec/fail.rb:2:in `block (2 levels) in <top (required)>'

Finished in 0.00031 seconds
1 example, 1 failure

Failed examples:

rspec ./spec/fail.rb:2 # fail
jeremywrowe commented 11 years ago

the top example is shortened to keep the example brief :)

latortuga commented 11 years ago

I did a little digging into the rspec-core source for this. The BacktraceCleaner class was introduced into rspec-core since version 2.13.1 so as a first attempt, you could upgrade to 2.14.0.rc1 and see if it fixes your problem. The logic for which lines are cleaned from a backtrace has changed slightly (they now use a combination whitelist and blacklist) though I'm not sure if it will change your results.

The only thing I could think of is that rspec is being invoked from a different working directory from zeus than you would normally invoke rspec. That would explain why it isn't excluding directories the way it normally would. I'm interested to know if upgrading rspec works for you - if not, then perhaps it's an issue with the way zeus invokes rspec.

jeremywrowe commented 11 years ago

@latortuga Thanks for digging into this for me, I will try the upgrade as suggested and see if there is any change. Just for completeness I am seeing the same thing when using test/unit. I wonder if other people are seeing the same thing? This normally wouldn't be a problem, but it is very annoying in a tmux session :)

minimul commented 10 years ago

+1 Same issue. I tried a bunch of stuff too. Not able to suppress the long backtrace.