minitest-reporters 1.3.6 → 1.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +28 -27
- data/.rubocop.yml +77 -77
- data/.ruby-gemset +1 -1
- data/.travis.yml +14 -14
- data/.yardopts +5 -5
- data/CHANGELOG.md +98 -93
- data/Gemfile +2 -2
- data/LICENSE +20 -20
- data/README.md +135 -135
- data/Rakefile +70 -70
- data/appveyor.yml +22 -22
- data/lib/minitest/extensible_backtrace_filter.rb +67 -67
- data/lib/minitest/minitest_reporter_plugin.rb +76 -76
- data/lib/minitest/old_activesupport_fix.rb +24 -24
- data/lib/minitest/relative_position.rb +26 -26
- data/lib/minitest/reporters.rb +91 -91
- data/lib/minitest/reporters/ansi.rb +30 -30
- data/lib/minitest/reporters/base_reporter.rb +136 -136
- data/lib/minitest/reporters/default_reporter.rb +228 -228
- data/lib/minitest/reporters/html_reporter.rb +224 -224
- data/lib/minitest/reporters/junit_reporter.rb +168 -164
- data/lib/minitest/reporters/mean_time_reporter.rb +388 -388
- data/lib/minitest/reporters/progress_reporter.rb +102 -96
- data/lib/minitest/reporters/ruby_mate_reporter.rb +54 -54
- data/lib/minitest/reporters/rubymine_reporter.rb +116 -116
- data/lib/minitest/reporters/spec_reporter.rb +61 -61
- data/lib/minitest/reporters/version.rb +5 -5
- data/lib/minitest/templates/index.html.erb +82 -82
- data/minitest-reporters.gemspec +31 -32
- data/test/fixtures/junit_filename_bug_example_test.rb +41 -41
- data/test/fixtures/mean_time_test.rb +36 -36
- data/test/fixtures/progress_detailed_skip_test.rb +8 -8
- data/test/fixtures/progress_test.rb +8 -8
- data/test/fixtures/sample_test.rb +15 -15
- data/test/fixtures/spec_test.rb +18 -18
- data/test/gallery/bad_test.rb +25 -25
- data/test/gallery/good_test.rb +14 -14
- data/test/integration/reporters/junit_reporter_test.rb +12 -12
- data/test/integration/reporters/mean_time_reporter_test.rb +7 -7
- data/test/integration/reporters/progress_reporter_test.rb +40 -40
- data/test/test_helper.rb +22 -22
- data/test/unit/minitest/extensible_backtrace_filter_test.rb +42 -42
- data/test/unit/minitest/junit_reporter_test.rb +46 -23
- data/test/unit/minitest/mean_time_reporter_unit_test.rb +149 -149
- data/test/unit/minitest/minitest_reporter_plugin_test.rb +14 -14
- data/test/unit/minitest/reporters_test.rb +65 -65
- data/test/unit/minitest/spec_reporter_test.rb +62 -62
- metadata +22 -5
@@ -1,96 +1,102 @@
|
|
1
|
-
require 'ruby-progressbar'
|
2
|
-
|
3
|
-
module Minitest
|
4
|
-
module Reporters
|
5
|
-
# Fuubar-like reporter with a progress bar.
|
6
|
-
#
|
7
|
-
# Based upon Jeff Kreefmeijer's Fuubar (MIT License) and paydro's
|
8
|
-
# monkey-patch.
|
9
|
-
#
|
10
|
-
# @see https://github.com/jeffkreeftmeijer/fuubar Fuubar
|
11
|
-
# @see https://gist.github.com/356945 paydro's monkey-patch
|
12
|
-
class ProgressReporter < BaseReporter
|
13
|
-
include RelativePosition
|
14
|
-
include ANSI::Code
|
15
|
-
|
16
|
-
PROGRESS_MARK = '='.freeze
|
17
|
-
|
18
|
-
def initialize(options = {})
|
19
|
-
super
|
20
|
-
@detailed_skip = options.fetch(:detailed_skip, true)
|
21
|
-
|
22
|
-
@progress = ProgressBar.create(
|
23
|
-
total: total_count,
|
24
|
-
starting_at: count,
|
25
|
-
progress_mark: green(PROGRESS_MARK),
|
26
|
-
remainder_mark: ' ',
|
27
|
-
format: options.fetch(:format, ' %C/%c: [%B] %p%% %a, %e'),
|
28
|
-
autostart: false
|
29
|
-
)
|
30
|
-
end
|
31
|
-
|
32
|
-
def start
|
33
|
-
super
|
34
|
-
puts('Started with run options %s' % options[:args])
|
35
|
-
puts
|
36
|
-
@progress.start
|
37
|
-
@progress.total = total_count
|
38
|
-
show
|
39
|
-
end
|
40
|
-
|
41
|
-
def
|
42
|
-
super
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
end
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
puts
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
end
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
1
|
+
require 'ruby-progressbar'
|
2
|
+
|
3
|
+
module Minitest
|
4
|
+
module Reporters
|
5
|
+
# Fuubar-like reporter with a progress bar.
|
6
|
+
#
|
7
|
+
# Based upon Jeff Kreefmeijer's Fuubar (MIT License) and paydro's
|
8
|
+
# monkey-patch.
|
9
|
+
#
|
10
|
+
# @see https://github.com/jeffkreeftmeijer/fuubar Fuubar
|
11
|
+
# @see https://gist.github.com/356945 paydro's monkey-patch
|
12
|
+
class ProgressReporter < BaseReporter
|
13
|
+
include RelativePosition
|
14
|
+
include ANSI::Code
|
15
|
+
|
16
|
+
PROGRESS_MARK = '='.freeze
|
17
|
+
|
18
|
+
def initialize(options = {})
|
19
|
+
super
|
20
|
+
@detailed_skip = options.fetch(:detailed_skip, true)
|
21
|
+
|
22
|
+
@progress = ProgressBar.create(
|
23
|
+
total: total_count,
|
24
|
+
starting_at: count,
|
25
|
+
progress_mark: green(PROGRESS_MARK),
|
26
|
+
remainder_mark: ' ',
|
27
|
+
format: options.fetch(:format, ' %C/%c: [%B] %p%% %a, %e'),
|
28
|
+
autostart: false
|
29
|
+
)
|
30
|
+
end
|
31
|
+
|
32
|
+
def start
|
33
|
+
super
|
34
|
+
puts('Started with run options %s' % options[:args])
|
35
|
+
puts
|
36
|
+
@progress.start
|
37
|
+
@progress.total = total_count
|
38
|
+
show
|
39
|
+
end
|
40
|
+
|
41
|
+
def before_test(test)
|
42
|
+
super
|
43
|
+
puts
|
44
|
+
puts("\n%s#%s" % [test_class(test), test.name]) if options[:verbose]
|
45
|
+
end
|
46
|
+
|
47
|
+
def record(test)
|
48
|
+
super
|
49
|
+
return if test.skipped? && !@detailed_skip
|
50
|
+
if test.failure
|
51
|
+
print "\e[0m\e[1000D\e[K"
|
52
|
+
print_colored_status(test)
|
53
|
+
print_test_with_time(test)
|
54
|
+
puts
|
55
|
+
print_info(test.failure, test.error?)
|
56
|
+
puts
|
57
|
+
end
|
58
|
+
|
59
|
+
if test.skipped? && color != "red"
|
60
|
+
self.color = "yellow"
|
61
|
+
elsif test.failure
|
62
|
+
self.color = "red"
|
63
|
+
end
|
64
|
+
|
65
|
+
show
|
66
|
+
end
|
67
|
+
|
68
|
+
def report
|
69
|
+
super
|
70
|
+
@progress.finish
|
71
|
+
|
72
|
+
puts
|
73
|
+
puts('Finished in %.5fs' % total_time)
|
74
|
+
print('%d tests, %d assertions, ' % [count, assertions])
|
75
|
+
color = failures.zero? && errors.zero? ? :green : :red
|
76
|
+
print(send(color) { '%d failures, %d errors, ' } % [failures, errors])
|
77
|
+
print(yellow { '%d skips' } % skips)
|
78
|
+
puts
|
79
|
+
end
|
80
|
+
|
81
|
+
private
|
82
|
+
|
83
|
+
def show
|
84
|
+
@progress.increment unless count == 0
|
85
|
+
end
|
86
|
+
|
87
|
+
def print_test_with_time(test)
|
88
|
+
puts [test.name, test_class(test), total_time].inspect
|
89
|
+
print(" %s#%s (%.2fs)" % [test.name, test_class(test), total_time])
|
90
|
+
end
|
91
|
+
|
92
|
+
def color
|
93
|
+
@color ||= "green"
|
94
|
+
end
|
95
|
+
|
96
|
+
def color=(color)
|
97
|
+
@color = color
|
98
|
+
@progress.progress_mark = send(color, PROGRESS_MARK)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
@@ -1,54 +1,54 @@
|
|
1
|
-
module Minitest
|
2
|
-
module Reporters
|
3
|
-
# Simple reporter designed for RubyMate.
|
4
|
-
class RubyMateReporter < BaseReporter
|
5
|
-
include RelativePosition
|
6
|
-
|
7
|
-
INFO_PADDING = 2
|
8
|
-
|
9
|
-
def start
|
10
|
-
super
|
11
|
-
puts('Started with run options %s' % options[:args])
|
12
|
-
puts
|
13
|
-
end
|
14
|
-
|
15
|
-
def record(test)
|
16
|
-
super
|
17
|
-
if test.skipped?
|
18
|
-
print 'SKIP'
|
19
|
-
print_test_with_time(test)
|
20
|
-
puts
|
21
|
-
puts
|
22
|
-
elsif test.error?
|
23
|
-
print 'ERROR'
|
24
|
-
print_test_with_time(test)
|
25
|
-
puts
|
26
|
-
print_info(test.failure)
|
27
|
-
puts
|
28
|
-
elsif test.failure
|
29
|
-
print 'FAIL'
|
30
|
-
print_test_with_time(test)
|
31
|
-
puts
|
32
|
-
print_info(test.failure, false)
|
33
|
-
puts
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def report
|
38
|
-
super
|
39
|
-
puts
|
40
|
-
puts('Finished in %.5fs' % total_time)
|
41
|
-
print('%d tests, %d assertions, ' % [count, assertions])
|
42
|
-
print('%d failures, %d errors, ' % [failures, errors])
|
43
|
-
print('%d skips' % skips)
|
44
|
-
puts
|
45
|
-
end
|
46
|
-
|
47
|
-
private
|
48
|
-
|
49
|
-
def print_test_with_time(test)
|
50
|
-
print(" #{test.class}##{test.name} (%.2fs)" % test.time)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
1
|
+
module Minitest
|
2
|
+
module Reporters
|
3
|
+
# Simple reporter designed for RubyMate.
|
4
|
+
class RubyMateReporter < BaseReporter
|
5
|
+
include RelativePosition
|
6
|
+
|
7
|
+
INFO_PADDING = 2
|
8
|
+
|
9
|
+
def start
|
10
|
+
super
|
11
|
+
puts('Started with run options %s' % options[:args])
|
12
|
+
puts
|
13
|
+
end
|
14
|
+
|
15
|
+
def record(test)
|
16
|
+
super
|
17
|
+
if test.skipped?
|
18
|
+
print 'SKIP'
|
19
|
+
print_test_with_time(test)
|
20
|
+
puts
|
21
|
+
puts
|
22
|
+
elsif test.error?
|
23
|
+
print 'ERROR'
|
24
|
+
print_test_with_time(test)
|
25
|
+
puts
|
26
|
+
print_info(test.failure)
|
27
|
+
puts
|
28
|
+
elsif test.failure
|
29
|
+
print 'FAIL'
|
30
|
+
print_test_with_time(test)
|
31
|
+
puts
|
32
|
+
print_info(test.failure, false)
|
33
|
+
puts
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def report
|
38
|
+
super
|
39
|
+
puts
|
40
|
+
puts('Finished in %.5fs' % total_time)
|
41
|
+
print('%d tests, %d assertions, ' % [count, assertions])
|
42
|
+
print('%d failures, %d errors, ' % [failures, errors])
|
43
|
+
print('%d skips' % skips)
|
44
|
+
puts
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def print_test_with_time(test)
|
50
|
+
print(" #{test.class}##{test.name} (%.2fs)" % test.time)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -1,116 +1,116 @@
|
|
1
|
-
# Test results reporter for RubyMine IDE (http://www.jetbrains.com/ruby/) and
|
2
|
-
# TeamCity(http://www.jetbrains.com/teamcity/) Continuous Integration Server
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'teamcity/runner_common'
|
6
|
-
require 'teamcity/utils/service_message_factory'
|
7
|
-
require 'teamcity/utils/runner_utils'
|
8
|
-
require 'teamcity/utils/url_formatter'
|
9
|
-
rescue LoadError
|
10
|
-
require "minitest/reporters/default_reporter"
|
11
|
-
|
12
|
-
# delegate to default reporter
|
13
|
-
module Minitest
|
14
|
-
module Reporters
|
15
|
-
class RubyMineReporter < DefaultReporter
|
16
|
-
def initialize(options = {})
|
17
|
-
super
|
18
|
-
puts("====================================================================================================\n")
|
19
|
-
puts("RubyMine reporter works only if it test was launched using RubyMine IDE or TeamCity CI server !!!\n")
|
20
|
-
puts("====================================================================================================\n")
|
21
|
-
puts("Using default results reporter...\n")
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
else
|
27
|
-
module Minitest
|
28
|
-
module Reporters
|
29
|
-
class RubyMineReporter < BaseReporter
|
30
|
-
include ANSI::Code
|
31
|
-
|
32
|
-
include ::Rake::TeamCity::RunnerCommon
|
33
|
-
include ::Rake::TeamCity::RunnerUtils
|
34
|
-
include ::Rake::TeamCity::Utils::UrlFormatter
|
35
|
-
|
36
|
-
def start
|
37
|
-
super
|
38
|
-
puts('Started with run options %s' % options[:args])
|
39
|
-
puts
|
40
|
-
|
41
|
-
# Setup test runner's MessageFactory
|
42
|
-
set_message_factory(Rake::TeamCity::MessageFactory)
|
43
|
-
log_test_reporter_attached
|
44
|
-
|
45
|
-
# Report tests count:
|
46
|
-
if ::Rake::TeamCity.is_in_idea_mode
|
47
|
-
log(@message_factory.create_tests_count(total_count))
|
48
|
-
elsif ::Rake::TeamCity.is_in_buildserver_mode
|
49
|
-
log(@message_factory.create_progress_message("Starting.. (#{total_count} tests)"))
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
def report
|
54
|
-
super
|
55
|
-
|
56
|
-
puts('Finished in %.5fs' % total_time)
|
57
|
-
print('%d tests, %d assertions, ' % [count, assertions])
|
58
|
-
print(red '%d failures, %d errors, ' % [failures, errors])
|
59
|
-
print(yellow '%d skips' % skips)
|
60
|
-
puts
|
61
|
-
end
|
62
|
-
|
63
|
-
def record(test)
|
64
|
-
super
|
65
|
-
unless test.passed?
|
66
|
-
with_result(test) do |exception_msg, backtrace|
|
67
|
-
if test.skipped?
|
68
|
-
log(@message_factory.create_test_ignored(test.name, exception_msg, backtrace))
|
69
|
-
elsif test.error?
|
70
|
-
log(@message_factory.create_test_error(test.name, exception_msg, backtrace))
|
71
|
-
else
|
72
|
-
log(@message_factory.create_test_failed(test.name, exception_msg, backtrace))
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
log(@message_factory.create_test_finished(test.name, get_time_in_ms(test.time)))
|
77
|
-
end
|
78
|
-
|
79
|
-
alias_method :output, :io
|
80
|
-
|
81
|
-
def before_suite(suite)
|
82
|
-
fqn = suite.name
|
83
|
-
log(@message_factory.create_suite_started(suite.name, location_from_ruby_qualified_name(fqn)))
|
84
|
-
end
|
85
|
-
|
86
|
-
def after_suite(suite)
|
87
|
-
log(@message_factory.create_suite_finished(suite.name))
|
88
|
-
end
|
89
|
-
|
90
|
-
def before_test(test)
|
91
|
-
super
|
92
|
-
location = test.class.instance_method(test.name).source_location
|
93
|
-
log(@message_factory.create_test_started(test.name, "file://#{location[0]}:#{location[1]}"))
|
94
|
-
end
|
95
|
-
|
96
|
-
#########
|
97
|
-
def log(msg)
|
98
|
-
output.flush
|
99
|
-
output.puts("\n#{msg}")
|
100
|
-
output.flush
|
101
|
-
|
102
|
-
# returns:
|
103
|
-
msg
|
104
|
-
end
|
105
|
-
|
106
|
-
def with_result(test)
|
107
|
-
exception = test.failure
|
108
|
-
msg = exception.nil? ? "" : "#{exception.class.name}: #{exception.message}"
|
109
|
-
backtrace = exception.nil? ? "" : filter_backtrace(exception.backtrace).join("\n")
|
110
|
-
|
111
|
-
yield(msg, backtrace)
|
112
|
-
end
|
113
|
-
end
|
114
|
-
end
|
115
|
-
end
|
116
|
-
end
|
1
|
+
# Test results reporter for RubyMine IDE (http://www.jetbrains.com/ruby/) and
|
2
|
+
# TeamCity(http://www.jetbrains.com/teamcity/) Continuous Integration Server
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'teamcity/runner_common'
|
6
|
+
require 'teamcity/utils/service_message_factory'
|
7
|
+
require 'teamcity/utils/runner_utils'
|
8
|
+
require 'teamcity/utils/url_formatter'
|
9
|
+
rescue LoadError
|
10
|
+
require "minitest/reporters/default_reporter"
|
11
|
+
|
12
|
+
# delegate to default reporter
|
13
|
+
module Minitest
|
14
|
+
module Reporters
|
15
|
+
class RubyMineReporter < DefaultReporter
|
16
|
+
def initialize(options = {})
|
17
|
+
super
|
18
|
+
puts("====================================================================================================\n")
|
19
|
+
puts("RubyMine reporter works only if it test was launched using RubyMine IDE or TeamCity CI server !!!\n")
|
20
|
+
puts("====================================================================================================\n")
|
21
|
+
puts("Using default results reporter...\n")
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
else
|
27
|
+
module Minitest
|
28
|
+
module Reporters
|
29
|
+
class RubyMineReporter < BaseReporter
|
30
|
+
include ANSI::Code
|
31
|
+
|
32
|
+
include ::Rake::TeamCity::RunnerCommon
|
33
|
+
include ::Rake::TeamCity::RunnerUtils
|
34
|
+
include ::Rake::TeamCity::Utils::UrlFormatter
|
35
|
+
|
36
|
+
def start
|
37
|
+
super
|
38
|
+
puts('Started with run options %s' % options[:args])
|
39
|
+
puts
|
40
|
+
|
41
|
+
# Setup test runner's MessageFactory
|
42
|
+
set_message_factory(Rake::TeamCity::MessageFactory)
|
43
|
+
log_test_reporter_attached
|
44
|
+
|
45
|
+
# Report tests count:
|
46
|
+
if ::Rake::TeamCity.is_in_idea_mode
|
47
|
+
log(@message_factory.create_tests_count(total_count))
|
48
|
+
elsif ::Rake::TeamCity.is_in_buildserver_mode
|
49
|
+
log(@message_factory.create_progress_message("Starting.. (#{total_count} tests)"))
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def report
|
54
|
+
super
|
55
|
+
|
56
|
+
puts('Finished in %.5fs' % total_time)
|
57
|
+
print('%d tests, %d assertions, ' % [count, assertions])
|
58
|
+
print(red '%d failures, %d errors, ' % [failures, errors])
|
59
|
+
print(yellow '%d skips' % skips)
|
60
|
+
puts
|
61
|
+
end
|
62
|
+
|
63
|
+
def record(test)
|
64
|
+
super
|
65
|
+
unless test.passed?
|
66
|
+
with_result(test) do |exception_msg, backtrace|
|
67
|
+
if test.skipped?
|
68
|
+
log(@message_factory.create_test_ignored(test.name, exception_msg, backtrace))
|
69
|
+
elsif test.error?
|
70
|
+
log(@message_factory.create_test_error(test.name, exception_msg, backtrace))
|
71
|
+
else
|
72
|
+
log(@message_factory.create_test_failed(test.name, exception_msg, backtrace))
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
log(@message_factory.create_test_finished(test.name, get_time_in_ms(test.time)))
|
77
|
+
end
|
78
|
+
|
79
|
+
alias_method :output, :io
|
80
|
+
|
81
|
+
def before_suite(suite)
|
82
|
+
fqn = suite.name
|
83
|
+
log(@message_factory.create_suite_started(suite.name, location_from_ruby_qualified_name(fqn)))
|
84
|
+
end
|
85
|
+
|
86
|
+
def after_suite(suite)
|
87
|
+
log(@message_factory.create_suite_finished(suite.name))
|
88
|
+
end
|
89
|
+
|
90
|
+
def before_test(test)
|
91
|
+
super
|
92
|
+
location = test.class.instance_method(test.name).source_location
|
93
|
+
log(@message_factory.create_test_started(test.name, "file://#{location[0]}:#{location[1]}"))
|
94
|
+
end
|
95
|
+
|
96
|
+
#########
|
97
|
+
def log(msg)
|
98
|
+
output.flush
|
99
|
+
output.puts("\n#{msg}")
|
100
|
+
output.flush
|
101
|
+
|
102
|
+
# returns:
|
103
|
+
msg
|
104
|
+
end
|
105
|
+
|
106
|
+
def with_result(test)
|
107
|
+
exception = test.failure
|
108
|
+
msg = exception.nil? ? "" : "#{exception.class.name}: #{exception.message}"
|
109
|
+
backtrace = exception.nil? ? "" : filter_backtrace(exception.backtrace).join("\n")
|
110
|
+
|
111
|
+
yield(msg, backtrace)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|