39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
# File 'lib/minitest/utils/reporter.rb', line 39
def report
super
io.sync = true
failing_results = results.reject(&:skipped?)
skipped_results = results.select(&:skipped?)
color = :green
color = :yellow if skipped_results.any?
color = :red if failing_results.any?
if failing_results.any? || skipped_results.any?
failing_results.each.with_index(1) do |result, index|
display_failing(result, index)
end
skipped_results
.each
.with_index(failing_results.size + 1) do |result, index|
display_skipped(result, index)
end
end
io.print "\n\n"
io.puts statistics
io.puts color(summary, color)
if failing_results.any?
io.puts "\nFailed Tests:\n"
failing_results.each {|result| display_replay_command(result) }
io.puts "\n\n"
else
threshold = 0.1 test_results =
Test
.tests
.values
.select { _1[:benchmark] }
.sort_by { _1[:benchmark].total }
.reverse
.take(10).filter { _1[:benchmark].total > threshold }
return unless test_results.any?
io.puts "\nSlow Tests:\n"
test_results.each_with_index do |info, index|
location = info[:source_location].join(":")
duration = humanize_duration(info[:benchmark].total * 1_000_000_000)
prefix = "#{index + 1}) "
padding = " " * prefix.size
io.puts color("#{prefix}#{info[:name]} (#{duration})", :red)
io.puts color("#{padding}#{location}", :gray)
io.puts
end
end
end
|