minitest-reporters 0.13.0 → 0.13.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -26,6 +26,7 @@ module MiniTest
26
26
 
27
27
  def _run_suite(suite, type)
28
28
  trigger_callback(:before_suite, suite)
29
+ self.start_time = Time.now
29
30
  super(suite, type)
30
31
  ensure
31
32
  trigger_callback(:after_suite, suite)
@@ -14,7 +14,9 @@ module MiniTest
14
14
  def initialize(options = {})
15
15
  @detailed_skip = options.fetch(:detailed_skip, true)
16
16
  @slow_count = options.fetch(:slow_count, 0)
17
+ @slow_suite_count = options.fetch(:slow_suite_count, 0)
17
18
  @test_times = []
19
+ @suite_times = []
18
20
  @color = options.fetch(:color) do
19
21
  output.tty? && (
20
22
  ENV["TERM"] == "screen" ||
@@ -51,6 +53,11 @@ module MiniTest
51
53
  after_test(red('E'))
52
54
  end
53
55
 
56
+ def after_suite(suite)
57
+ time = Time.now - runner.suite_start_time
58
+ @suite_times << [suite.name, time]
59
+ end
60
+
54
61
  def after_suites(suites, type)
55
62
  time = Time.now - runner.suites_start_time
56
63
  status_line = "Finished %ss in %.6fs, %.4f tests/s, %.4f assertions/s." %
@@ -81,8 +88,20 @@ module MiniTest
81
88
  end
82
89
  end
83
90
 
91
+ if @slow_suite_count > 0
92
+ slow_suites = @suite_times.sort_by { |x| x[1] }.reverse.take(@slow_suite_count)
93
+
94
+ puts
95
+ puts "Slowest test classes:"
96
+ puts
97
+
98
+ slow_suites.each do |slow_suite|
99
+ puts "%.6fs %s" % [slow_suite[1], slow_suite[0]]
100
+ end
101
+ end
102
+
84
103
  puts
85
- puts colored_for(suite_result, result_line)
104
+ print colored_for(suite_result, result_line)
86
105
  end
87
106
 
88
107
  private
@@ -1,5 +1,5 @@
1
1
  module MiniTest
2
2
  module Reporters
3
- VERSION = "0.13.0"
3
+ VERSION = "0.13.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest-reporters
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.13.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-27 00:00:00.000000000 Z
12
+ date: 2012-12-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: minitest
@@ -162,7 +162,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
162
162
  version: '0'
163
163
  segments:
164
164
  - 0
165
- hash: 1859525980406151277
165
+ hash: 4420314549053922835
166
166
  required_rubygems_version: !ruby/object:Gem::Requirement
167
167
  none: false
168
168
  requirements:
@@ -171,7 +171,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
171
171
  version: '0'
172
172
  segments:
173
173
  - 0
174
- hash: 1859525980406151277
174
+ hash: 4420314549053922835
175
175
  requirements: []
176
176
  rubyforge_project: minitest-reporters
177
177
  rubygems_version: 1.8.24