"rails test" command prints out a very long output

Viewed 251

Summary of problem:

While running "rails test" command on bash terminal, it prints out a very very long list (few thousand lines stuff), which makes finding the error tough (because it is located the the top).

What I have tried:

I have tried "rails test --help" to see if there is any commands to disable such long printing but to no avail.

System info:

Ubuntu 20.04

ruby=3.0.0

rails=6.1.3

gem=3.2.3

yarn=1.22.10

Problem output:

jhunhong@msipc:~/RailsProject/sample_app (static-pages)$ rails test
Running via Spring preloader in process 154409
Started with run options --seed 20098

ERROR["test_should_get_about", #<Minitest::Reporters::Suite:0x00007f956800e858 @name="StaticPagesControllerTest">, 0.06735827699594665]
 test_should_get_about#StaticPagesControllerTest (0.07s)
NameError:         NameError: undefined local variable or method `static_pages_about__url' for #<StaticPagesControllerTest:0x000055f376974e78 @_routes=nil, @NAME="test_should_get_about", @failures=[#<Minitest::UnexpectedError: Unexpected exception>], @assertions=0, @integration_session=#<#<Class:0x000055f376974888>:0x000055f376974220 @_routes=nil, @app=#<SampleApp::Application:0x000055f3741a9290 @_all_autoload_paths=["/home/jhunhong/RailsProject/sample_app/app/channels", "/home/jhunhong/RailsProject/sample_app/app/controllers", "/home/jhunhong/RailsProject/sample_app/app/controllers/concerns", "/home/jhunhong/RailsProject
1 Answers

You could add -f or --fail-fast option, i.e. rails test -f.

Which stop running tests when the first test fails.

Related