Skip to content

Commit

Permalink
Print report green if no failures
Browse files Browse the repository at this point in the history
  • Loading branch information
ngoral committed Jan 16, 2024
1 parent 188deae commit 3ba91bb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/fitting/log.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,14 @@ def self.report(logs)
Fitting::Log.failure(logs).each_with_index do |log, index|
puts "\e[31m #{index + 1}) #{log.error.class} #{log.error.message}\n\n\e[0m"
end
print "\e[31m#{logs.size} examples, #{Fitting::Log.failure(logs).size} failure, #{Fitting::Log.pending(logs).size} pending\e[0m\n"

failure_count = Fitting::Log.failure(logs).size
color_code = failure_count > 0 ? 31 : 32
print "\e[#{color_code}m#{logs.size} examples, #{failure_count} failure, #{Fitting::Log.pending(logs).size} pending\e[0m\n"

unless Fitting::Log.failure(logs).size <= 0
exit 1
end
end
end
end
end

0 comments on commit 3ba91bb

Please sign in to comment.