minitest-reporters 0.14.7 → 0.14.8

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -33,7 +33,7 @@ MiniTest::Reporters.use! [MiniTest::Reporters::SpecReporter.new, MiniTest::Repor
33
33
  The following reporters are provided:
34
34
 
35
35
  ```ruby
36
- MiniTest::Reporters::DefaultReporter # => Redgreen version of standard MiniTest reporter
36
+ MiniTest::Reporters::DefaultReporter # => Redgreen-capable version of standard MiniTest reporter
37
37
  MiniTest::Reporters::SpecReporter # => Turn-like output that reads like a spec
38
38
  MiniTest::Reporters::ProgressReporter # => Fuubar-like output with a progress bar
39
39
  MiniTest::Reporters::RubyMateReporter # => Simple reporter designed for RubyMate
@@ -42,6 +42,13 @@ MiniTest::Reporters::GuardReporter # => Integrates with guard-minitest to pro
42
42
  MiniTest::Reporters::JUnitReporter # => JUnit test reporter designed for JetBrains TeamCity
43
43
  ```
44
44
 
45
+ Options can be passed to these reporters at construction-time, e.g. to force
46
+ color output from `DefaultReporter`:
47
+
48
+ ```ruby
49
+ MiniTest::Reporters.use! [MiniTest::Reporters::SpecReporter.new(:color => true)]
50
+ ```
51
+
45
52
  ## Note on Patches/Pull Requests ##
46
53
 
47
54
  * Fork the project.
@@ -21,8 +21,7 @@ module MiniTest
21
21
  @suite_times = []
22
22
  @color = options.fetch(:color) do
23
23
  output.tty? && (
24
- ENV["TERM"] == "screen" ||
25
- ENV["TERM"] =~ /term(?:-(?:256)?color)?\z/ ||
24
+ ENV["TERM"] =~ /^screen|color/ ||
26
25
  ENV["EMACS"] == "t"
27
26
  )
28
27
  end
@@ -201,6 +200,7 @@ module MiniTest
201
200
  end
202
201
 
203
202
  def print_info(e)
203
+ print "#{e.exception.class.to_s}: "
204
204
  e.message.each_line { |line| print_with_info_padding(line) }
205
205
  filter_backtrace(e.backtrace).each { |line| print_with_info_padding(line) }
206
206
  end
@@ -107,6 +107,7 @@ module MiniTest
107
107
  end
108
108
 
109
109
  def print_info(e)
110
+ print pad("#{e.exception.class.to_s}: ")
110
111
  e.message.each_line { |line| puts pad(line) }
111
112
 
112
113
  trace = filter_backtrace(e.backtrace)
@@ -55,6 +55,7 @@ module MiniTest
55
55
  end
56
56
 
57
57
  def print_info(e)
58
+ print "#{e.exception.class.to_s}: "
58
59
  e.message.each_line { |line| puts pad(line) }
59
60
 
60
61
  trace = filter_backtrace(e.backtrace)
@@ -13,6 +13,10 @@ module MiniTest
13
13
  include ANSI::Code
14
14
  include RelativePosition
15
15
 
16
+ def initialize
17
+ @suites = []
18
+ end
19
+
16
20
  def before_suites(suites, type)
17
21
  puts 'Started'
18
22
  puts
@@ -28,31 +32,29 @@ module MiniTest
28
32
  puts
29
33
  end
30
34
 
31
- def before_suite(suite)
32
- puts suite.name
33
- end
34
-
35
35
  def after_suite(suite)
36
- puts
37
- end
38
-
39
- def before_test(suite, test)
40
- print pad_test(test)
36
+ puts if @suites.include?(suite)
41
37
  end
42
38
 
43
39
  def pass(suite, test, test_runner)
40
+ print_suite(suite) unless @suites.include?(suite)
41
+ print pad_test(test)
44
42
  print(green { pad_mark('PASS') })
45
43
  print_time(test)
46
44
  puts
47
45
  end
48
46
 
49
47
  def skip(suite, test, test_runner)
48
+ print_suite(suite) unless @suites.include?(suite)
49
+ print pad_test(test)
50
50
  print(yellow { pad_mark('SKIP') })
51
51
  print_time(test)
52
52
  puts
53
53
  end
54
54
 
55
55
  def failure(suite, test, test_runner)
56
+ print_suite(suite) unless @suites.include?(suite)
57
+ print pad_test(test)
56
58
  print(red { pad_mark('FAIL') })
57
59
  print_time(test)
58
60
  puts
@@ -61,6 +63,8 @@ module MiniTest
61
63
  end
62
64
 
63
65
  def error(suite, test, test_runner)
66
+ print_suite(suite) unless @suites.include?(suite)
67
+ print pad_test(test)
64
68
  print(red { pad_mark('ERROR') })
65
69
  print_time(test)
66
70
  puts
@@ -70,12 +74,18 @@ module MiniTest
70
74
 
71
75
  private
72
76
 
77
+ def print_suite(suite)
78
+ puts suite.name
79
+ @suites << suite
80
+ end
81
+
73
82
  def print_time(test)
74
83
  total_time = Time.now - (runner.test_start_time || Time.now)
75
84
  print(" (%.2fs)" % total_time)
76
85
  end
77
86
 
78
87
  def print_info(e)
88
+ print "#{e.exception.class.to_s}: "
79
89
  e.message.each_line { |line| print_with_info_padding(line) }
80
90
 
81
91
  trace = filter_backtrace(e.backtrace)
@@ -1,5 +1,5 @@
1
1
  module MiniTest
2
2
  module Reporters
3
- VERSION = "0.14.7"
3
+ VERSION = "0.14.8"
4
4
  end
5
5
  end
@@ -1,4 +1,5 @@
1
1
  require_relative "../../test_helper"
2
+ require "stringio"
2
3
 
3
4
  module MiniTestReportersTest
4
5
  class ReportersTest < TestCase
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.14.7
4
+ version: 0.14.8
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: 2013-01-25 00:00:00.000000000 Z
12
+ date: 2013-03-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: minitest
@@ -164,7 +164,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
164
164
  version: '0'
165
165
  segments:
166
166
  - 0
167
- hash: -1014601908327650924
167
+ hash: -4301749252106507079
168
168
  required_rubygems_version: !ruby/object:Gem::Requirement
169
169
  none: false
170
170
  requirements:
@@ -173,7 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
173
173
  version: '0'
174
174
  segments:
175
175
  - 0
176
- hash: -1014601908327650924
176
+ hash: -4301749252106507079
177
177
  requirements: []
178
178
  rubyforge_project: minitest-reporters
179
179
  rubygems_version: 1.8.24