Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

show extended output on testtask fail only with verbose or trace #163

Merged
merged 2 commits into from
Sep 20, 2016

Conversation

bretts
Copy link
Contributor

@bretts bretts commented Sep 20, 2016

When using Rake::TestTask with a lot of files at once, sometimes the failure output from rake is quite overwhelming (because of the file list appended to the message "Command failed with status..."). This commit only shows that extended information if the user asks for verbose output in the Rake::TestTask or uses the --trace command when invoking rake.

"[ruby #{args}]"
status = "Command failed with status (#{status.exitstatus})"
details = ": [ruby #{args}]"
fail (ARGV.include?('--trace') || @verbose) ? (status + details) : status
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ARGV may no longer include '--trace' by the time we get here (Rakefile authors may change it). Switching to Rake.application.options.trace will keep this value.

Also, can you do one thing per line so this is easier to maintain? Like this:

message =
  if Rake.application.options.trace or @verbose then
    status + details
  else
    status
  end

fail message

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, thanks!

@drbrain drbrain merged commit d027052 into ruby:master Sep 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants