Make "rake test" display not only task name but also exception message. #1899

Merged
merged 2 commits into from Jun 29, 2011

Conversation

Projects
None yet
2 participants
Contributor

ihower commented Jun 29, 2011

The "rake test" ignores the exception message. This pull request displays not only task name but also the exception message.

For example:

Errors running test:units, test:functionals!

This pull request:

Errors running test:units! Access denied for user ''@'localhost' to database...
Errors running test:functionals! Command failed with status...

Member

josevalim commented Jun 29, 2011

Tks for the pull request, I like it. Do you think you could add a test to this new format? We already have some here:

https://github.com/rails/rails/blob/master/railties/test/application/rake_test.rb

Contributor

ihower commented Jun 29, 2011

Add test. I can't find good way to test the abort message so I change to puts.

Member

josevalim commented Jun 29, 2011

Thanks. About capturing stderr, wouldn't using capture(:stderr) work? It is defined in this file (that probably should be required as well):

https://github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/kernel/reporting.rb

Contributor

ihower commented Jun 29, 2011

It seems the abort method writes to STDERR directly, not $stderr, so it will capture nothing.
STDERR only support reopen to change the os's file descriptor and does not accept StringIO.new :/

josevalim merged commit c49d1f2 into rails:master Jun 29, 2011

Member

josevalim commented Jun 29, 2011

Fair enough. merged, thanks!

ihower deleted the ihower:patch_rake_test branch Aug 16, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment