Skip to content

Commit

Permalink
Merge pull request #160 from ngoral/color_code_report
Browse files Browse the repository at this point in the history
Print report green if no failures
  • Loading branch information
tuwilof authored Jan 16, 2024
2 parents 188deae + 3ba91bb commit a1028a4
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 a1028a4

Please sign in to comment.