使用'rails test'时如何抑制所有这些信息

时间:2018-03-09 03:55:09

标签: ruby-on-rails

每当我运行rails test时,它会返回测试,然后返回一堆额外的代码。我不想要那么多。我是否必须添加代码或更改内容以隐藏堆栈跟踪,

ec2-user:~/environment/sample_app (master) $ rails test
Running via Spring preloader in process 12952
Started with run options --seed 32554

Run options: --seed 32554--=---=---=---=---=---=---=---=---=---=---=---=---=---=---=---=---=] 0% Time: 00:00:00,  ETA: ??:??:??

# Running:

..  4/3: [===============================
===============================                     
] 75% Time: 00:00:00,  ETA: 00:00:.  4/4: 
 [=======================================
===========================================] 100% Time: 00:00:00, Time: 
00:00:00
.
Finished in 0.15399s
4 tests, 8 assertions, 0 failures, 0 errors, 0 skips
/usr/local/rvm/gems/ruby-2.4.1/gems/notiffany-
0.1.1/lib/notiffany/notifier/tmux/client.rb:12:in `version': undefined 
method `[]' for nil:NilClass (NoMethodError)
    from /usr/local/rvm/gems/ruby-2.4.1/gems/notiffany-
0.1.1/lib/notiffany/notifier/tmux.rb:69:in `_check_available'
    from /usr/local/rvm/gems/ruby-2.4.1/gems/notiffany-
0.1.1/lib/notiffany/notifier/base.rb:59:in `initialize'
    from /usr/local/rvm/gems/ruby-2.4.1/gems/notiffany-
0.1.1/lib/notiffany/notifier/detected.rb:100:in `new'
    from /usr/local/rvm/gems/ruby-2.4.1/gems/notiffany-
0.1.1/lib/notiffany/notifier/detected.rb:100:in `_add'
    from /usr/local/rvm/gems/ruby-2.4.1/gems/notiffany-
0.1.1/lib/notiffany/notifier/detected.rb:62:in `block (2 levels) in detect'
    from /usr/local/rvm/gems/ruby-2.4.1/gems/notiffany-
0.1.1/lib/notiffany/notifier/detected.rb:60:in `each'
    from /usr/local/rvm/gems/ruby-2.4.1/gems/notiffany-
0.1.1/lib/notiffany/notifier/detected.rb:60:in `detect'
    from /usr/local/rvm/gems/ruby-2.4.1/gems/notiffany-
0.1.1/lib/notiffany/notifier/detected.rb:60:in `block in detect'
    from /usr/local/rvm/gems/ruby-2.4.1/gems/notiffany-
0.1.1/lib/notiffany/notifier/detected.rb:59:in `each'
    from /usr/local/rvm/gems/ruby-2.4.1/gems/notiffany-
0.1.1/lib/notiffany/notifier/detected.rb:59:in `detect'
    from /usr/local/rvm/gems/ruby-2.4.1/gems/notiffany-
0.1.1/lib/notiffany/notifier.rb:180:in `_detect_or_add_notifiers'
    from /usr/local/rvm/gems/ruby-2.4.1/gems/notiffany-
0.1.1/lib/notiffany/notifier.rb:198:in `_activate'
    from /usr/local/rvm/gems/ruby-2.4.1/gems/notiffany-
0.1.1/lib/notiffany/notifier.rb:87:in `initialize'
    from /usr/local/rvm/gems/ruby-2.4.1/gems/notiffany-
0.1.1/lib/notiffany/notifier.rb:42:in `new'
    from /usr/local/rvm/gems/ruby-2.4.1/gems/notiffany-
0.1.1/lib/notiffany/notifier.rb:42:in `connect'
    from /usr/local/rvm/gems/ruby-2.4.1/gems/guard-
2.13.0/lib/guard/notifier.rb:11:in `connect'
    from /usr/local/rvm/gems/ruby-2.4.1/gems/guard-
2.13.0/lib/guard/notifier.rb:31:in `notify'
    from /usr/local/rvm/gems/ruby-2.4.1/gems/guard-compat-
1.2.1/lib/guard/compat/plugin.rb:113:in `notify'
    from /usr/local/rvm/gems/ruby-2.4.1/gems/guard-minitest-
2.4.4/lib/guard/minitest/notifier.rb:31:in `notify'
    from /usr/local/rvm/gems/ruby-2.4.1/gems/guard-minitest-
2.4.4/lib/guard/minitest/reporter.rb:10:in `report'
    from /usr/local/rvm/gems/ruby-2.4.1/gems/minitest-
5.11.3/lib/minitest.rb:808:in `each'
    from /usr/local/rvm/gems/ruby-2.4.1/gems/minitest-
5.11.3/lib/minitest.rb:808:in `report'
    from /usr/local/rvm/gems/ruby-2.4.1/gems/minitest-
5.11.3/lib/minitest.rb:141:in `run'
    from /usr/local/rvm/gems/ruby-2.4.1/gems/minitest-
5.11.3/lib/minitest.rb:63:in `block in autorun'
    from /usr/local/rvm/gems/ruby-2.4.1/gems/spring-
2.0.2/lib/spring/application.rb:171:in `fork'
    from /usr/local/rvm/gems/ruby-2.4.1/gems/spring-
2.0.2/lib/spring/application.rb:171:in `serve'
    from /usr/local/rvm/gems/ruby-2.4.1/gems/spring-
2.0.2/lib/spring/application.rb:141:in `block in run'
    from /usr/local/rvm/gems/ruby-2.4.1/gems/spring-
2.0.2/lib/spring/application.rb:135:in `loop'
    from /usr/local/rvm/gems/ruby-2.4.1/gems/spring-
2.0.2/lib/spring/application.rb:135:in `run'
    from /usr/local/rvm/gems/ruby-2.4.1/gems/spring-
2.0.2/lib/spring/application/boot.rb:19:in `<top (required)>'
    from /usr/local/rvm/rubies/ruby-
2.4.1/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in 
`require'
    from /usr/local/rvm/rubies/ruby-
2.4.1/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in 
`require'
    from -e:1:in `<main>'

看看大多数东西是无用的。只是顶部和错误计数就足够了。

1 个答案:

答案 0 :(得分:0)

在测试运行后,看起来notiffany gem会抛出错误。

您可以尝试删除gem或在测试环境中禁用它。

https://github.com/guard/notiffany