From 21130fe15db191d4a097c4d150f7e17e8c56ad56 Mon Sep 17 00:00:00 2001 From: Brett Sykes Date: Tue, 20 Sep 2016 11:25:07 -0400 Subject: [PATCH 1/2] show extended output on testtask fail only with verbose or trace --- lib/rake/testtask.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/rake/testtask.rb b/lib/rake/testtask.rb index 4fb871e46..85dd8552b 100644 --- a/lib/rake/testtask.rb +++ b/lib/rake/testtask.rb @@ -116,8 +116,9 @@ def define if !ok && status.respond_to?(:signaled?) && status.signaled? raise SignalException.new(status.termsig) elsif !ok - fail "Command failed with status (#{status.exitstatus}): " + - "[ruby #{args}]" + status = "Command failed with status (#{status.exitstatus})" + details = ": [ruby #{args}]" + fail (ARGV.include?('--trace') || @verbose) ? (status + details) : status end end end From b878500058fd7ac669d9988b3ef242188a14c1ba Mon Sep 17 00:00:00 2001 From: Brett Sykes Date: Tue, 20 Sep 2016 14:27:46 -0400 Subject: [PATCH 2/2] updates based on comments from drbrain --- lib/rake/testtask.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/rake/testtask.rb b/lib/rake/testtask.rb index 85dd8552b..1a83c30ec 100644 --- a/lib/rake/testtask.rb +++ b/lib/rake/testtask.rb @@ -118,7 +118,14 @@ def define elsif !ok status = "Command failed with status (#{status.exitstatus})" details = ": [ruby #{args}]" - fail (ARGV.include?('--trace') || @verbose) ? (status + details) : status + message = + if Rake.application.options.trace or @verbose then + status + details + else + status + end + + fail message end end end