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.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +28 -27
  3. data/.rubocop.yml +77 -77
  4. data/.ruby-gemset +1 -1
  5. data/.travis.yml +14 -14
  6. data/.yardopts +5 -5
  7. data/CHANGELOG.md +98 -93
  8. data/Gemfile +2 -2
  9. data/LICENSE +20 -20
  10. data/README.md +135 -135
  11. data/Rakefile +70 -70
  12. data/appveyor.yml +22 -22
  13. data/lib/minitest/extensible_backtrace_filter.rb +67 -67
  14. data/lib/minitest/minitest_reporter_plugin.rb +76 -76
  15. data/lib/minitest/old_activesupport_fix.rb +24 -24
  16. data/lib/minitest/relative_position.rb +26 -26
  17. data/lib/minitest/reporters.rb +91 -91
  18. data/lib/minitest/reporters/ansi.rb +30 -30
  19. data/lib/minitest/reporters/base_reporter.rb +136 -136
  20. data/lib/minitest/reporters/default_reporter.rb +228 -228
  21. data/lib/minitest/reporters/html_reporter.rb +224 -224
  22. data/lib/minitest/reporters/junit_reporter.rb +168 -164
  23. data/lib/minitest/reporters/mean_time_reporter.rb +388 -388
  24. data/lib/minitest/reporters/progress_reporter.rb +102 -96
  25. data/lib/minitest/reporters/ruby_mate_reporter.rb +54 -54
  26. data/lib/minitest/reporters/rubymine_reporter.rb +116 -116
  27. data/lib/minitest/reporters/spec_reporter.rb +61 -61
  28. data/lib/minitest/reporters/version.rb +5 -5
  29. data/lib/minitest/templates/index.html.erb +82 -82
  30. data/minitest-reporters.gemspec +31 -32
  31. data/test/fixtures/junit_filename_bug_example_test.rb +41 -41
  32. data/test/fixtures/mean_time_test.rb +36 -36
  33. data/test/fixtures/progress_detailed_skip_test.rb +8 -8
  34. data/test/fixtures/progress_test.rb +8 -8
  35. data/test/fixtures/sample_test.rb +15 -15
  36. data/test/fixtures/spec_test.rb +18 -18
  37. data/test/gallery/bad_test.rb +25 -25
  38. data/test/gallery/good_test.rb +14 -14
  39. data/test/integration/reporters/junit_reporter_test.rb +12 -12
  40. data/test/integration/reporters/mean_time_reporter_test.rb +7 -7
  41. data/test/integration/reporters/progress_reporter_test.rb +40 -40
  42. data/test/test_helper.rb +22 -22
  43. data/test/unit/minitest/extensible_backtrace_filter_test.rb +42 -42
  44. data/test/unit/minitest/junit_reporter_test.rb +46 -23
  45. data/test/unit/minitest/mean_time_reporter_unit_test.rb +149 -149
  46. data/test/unit/minitest/minitest_reporter_plugin_test.rb +14 -14
  47. data/test/unit/minitest/reporters_test.rb +65 -65
  48. data/test/unit/minitest/spec_reporter_test.rb +62 -62
  49. metadata +22 -5
@@ -1,61 +1,61 @@
1
- module Minitest
2
- module Reporters
3
- # Turn-like reporter that reads like a spec.
4
- #
5
- # Based upon TwP's turn (MIT License) and paydro's monkey-patch.
6
- #
7
- # @see https://github.com/TwP/turn turn
8
- # @see https://gist.github.com/356945 paydro's monkey-patch
9
- class SpecReporter < BaseReporter
10
- include ANSI::Code
11
- include RelativePosition
12
-
13
- def start
14
- super
15
- puts('Started with run options %s' % options[:args])
16
- puts
17
- end
18
-
19
- def report
20
- super
21
- puts('Finished in %.5fs' % total_time)
22
- print('%d tests, %d assertions, ' % [count, assertions])
23
- color = failures.zero? && errors.zero? ? :green : :red
24
- print(send(color) { '%d failures, %d errors, ' } % [failures, errors])
25
- print(yellow { '%d skips' } % skips)
26
- puts
27
- end
28
-
29
- def record(test)
30
- super
31
- record_print_status(test)
32
- record_print_failures_if_any(test)
33
- end
34
-
35
- protected
36
-
37
- def before_suite(suite)
38
- puts suite
39
- end
40
-
41
- def after_suite(_suite)
42
- puts
43
- end
44
-
45
- def record_print_status(test)
46
- test_name = test.name.gsub(/^test_: /, 'test:')
47
- print pad_test(test_name)
48
- print_colored_status(test)
49
- print(" (%.2fs)" % test.time) unless test.time.nil?
50
- puts
51
- end
52
-
53
- def record_print_failures_if_any(test)
54
- if !test.skipped? && test.failure
55
- print_info(test.failure, test.error?)
56
- puts
57
- end
58
- end
59
- end
60
- end
61
- end
1
+ module Minitest
2
+ module Reporters
3
+ # Turn-like reporter that reads like a spec.
4
+ #
5
+ # Based upon TwP's turn (MIT License) and paydro's monkey-patch.
6
+ #
7
+ # @see https://github.com/TwP/turn turn
8
+ # @see https://gist.github.com/356945 paydro's monkey-patch
9
+ class SpecReporter < BaseReporter
10
+ include ANSI::Code
11
+ include RelativePosition
12
+
13
+ def start
14
+ super
15
+ puts('Started with run options %s' % options[:args])
16
+ puts
17
+ end
18
+
19
+ def report
20
+ super
21
+ puts('Finished in %.5fs' % total_time)
22
+ print('%d tests, %d assertions, ' % [count, assertions])
23
+ color = failures.zero? && errors.zero? ? :green : :red
24
+ print(send(color) { '%d failures, %d errors, ' } % [failures, errors])
25
+ print(yellow { '%d skips' } % skips)
26
+ puts
27
+ end
28
+
29
+ def record(test)
30
+ super
31
+ record_print_status(test)
32
+ record_print_failures_if_any(test)
33
+ end
34
+
35
+ protected
36
+
37
+ def before_suite(suite)
38
+ puts suite
39
+ end
40
+
41
+ def after_suite(_suite)
42
+ puts
43
+ end
44
+
45
+ def record_print_status(test)
46
+ test_name = test.name.gsub(/^test_: /, 'test:')
47
+ print pad_test(test_name)
48
+ print_colored_status(test)
49
+ print(" (%.2fs)" % test.time) unless test.time.nil?
50
+ puts
51
+ end
52
+
53
+ def record_print_failures_if_any(test)
54
+ if !test.skipped? && test.failure
55
+ print_info(test.failure, test.error?)
56
+ puts
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
@@ -1,5 +1,5 @@
1
- module Minitest
2
- module Reporters
3
- VERSION = '1.3.6'.freeze
4
- end
5
- end
1
+ module Minitest
2
+ module Reporters
3
+ VERSION = '1.3.7'.freeze
4
+ end
5
+ end
@@ -1,83 +1,83 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <title><%= title %></title>
5
- <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet">
6
- <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
7
- <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
8
- <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
9
- </head>
10
-
11
- <body>
12
- <div class="container">
13
- <div class="jumbotron">
14
- <h1><%= title %></h1>
15
- <p>
16
- Finished in <%= total_time_to_hms %>, <%= '%.2f tests/s' % (count / total_time) %>, <%= '%.2f assertions/s' % (assertions / total_time) %>
17
- </p>
18
- <p>
19
- <strong>
20
- <span class="<%= 'text-info' if (failures == 0 && errors == 0) %>"><%= '%d' % count %> tests</span>,
21
- <span class="<%= 'text-info' if (failures == 0 && errors == 0) %>"> <%= '%d' % assertions %> assertions</span>,
22
- <span class="<%= 'text-danger' if failures > 0 %>"> <%= '%d' % failures %> failures</span>,
23
- <span class="<%= 'text-danger' if errors > 0 %>"> <%= '%d' % errors %> errors</span>,
24
- <span class="<%= 'text-warning' if skips > 0 %>"> <%= '%d' % skips %> skips</span>
25
- </strong>
26
- </p>
27
-
28
- <div class="progress">
29
- <div class="progress-bar progress-bar-info" style="width: <%= percent_passes %>%">
30
- <%= '%d' % percent_passes %>% passed
31
- </div>
32
- <div class="progress-bar progress-bar-danger" style="width: <%= percent_errors_failures %>%">
33
- <%= '%d' % percent_errors_failures %>% failed
34
- </div>
35
- <div class="progress-bar progress-bar-warning" style="width: <%= percent_skipps %>%">
36
- <%= '%d' % percent_skipps %>% skipped
37
- </div>
38
- </div>
39
-
40
-
41
- </div>
42
-
43
- <% suites.each do |suite| %>
44
- <div class="panel panel-default">
45
- <div class="panel-heading"><strong><%= suite[:name] %></strong>
46
- <span class="pull-right">
47
- <span class="<%= 'text-info' if (suite[:fail_count] == 0 && suite[:error_count] == 0) %>"><%= '%d' % suite[:test_count] %> tests</span>,
48
- <span class="<%= 'text-info' if (failures == 0 && errors == 0) %>"> <%= '%d' % suite[:assertion_count] %> assertions</span>,
49
- <span class="<%= 'text-danger' if suite[:fail_count] > 0 %>"> <%= '%d' % suite[:fail_count] %> failures</span>,
50
- <span class="<%= 'text-danger' if suite[:error_count] > 0 %>"> <%= '%d' % suite[:error_count] %> errors</span>,
51
- <span class="<%= 'text-warning' if suite[:skip_count] > 0 %>"> <%= '%d' % suite[:skip_count] %> skips</span>,
52
- <span> finished in <%= '%.4fs' % suite[:time] %></span>
53
- </span>
54
- </div>
55
- <div class="panel-body">
56
- <div class="list-group">
57
- <% suite[:tests].each do |test| %>
58
- <div class="list-group-item">
59
- <h5 class="list-group-item-heading">
60
- <% if result(test) == :pass %>
61
- <span class="glyphicon glyphicon-ok text-info" aria-hidden="true"></span>
62
- <% elsif result(test) == :skip %>
63
- <span class="glyphicon glyphicon-ban-circle text-warning" aria-hidden="true"></span>
64
- <% else %>
65
- <span class="glyphicon glyphicon-remove text-danger" aria-hidden="true"></span>
66
- <% end %>
67
- <%= friendly_name(test) %>
68
- <span class="pull-right">
69
- Assertions <%= test.assertions %>, time <%= ('%.6fs' % test.time) %>
70
- </span>
71
- </h5>
72
- <% if !test.passed? %>
73
- <pre class="list-group-item-text"><%= "#{location(test.failure)}\n\n#{test.failure.message}" %></pre>
74
- <% end %>
75
- </div>
76
- <% end %>
77
- </div>
78
- </div>
79
- </div>
80
- <% end %>
81
- </div>
82
- </body>
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <title><%= title %></title>
5
+ <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet">
6
+ <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
7
+ <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
8
+ <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
9
+ </head>
10
+
11
+ <body>
12
+ <div class="container">
13
+ <div class="jumbotron">
14
+ <h1><%= title %></h1>
15
+ <p>
16
+ Finished in <%= total_time_to_hms %>, <%= '%.2f tests/s' % (count / total_time) %>, <%= '%.2f assertions/s' % (assertions / total_time) %>
17
+ </p>
18
+ <p>
19
+ <strong>
20
+ <span class="<%= 'text-info' if (failures == 0 && errors == 0) %>"><%= '%d' % count %> tests</span>,
21
+ <span class="<%= 'text-info' if (failures == 0 && errors == 0) %>"> <%= '%d' % assertions %> assertions</span>,
22
+ <span class="<%= 'text-danger' if failures > 0 %>"> <%= '%d' % failures %> failures</span>,
23
+ <span class="<%= 'text-danger' if errors > 0 %>"> <%= '%d' % errors %> errors</span>,
24
+ <span class="<%= 'text-warning' if skips > 0 %>"> <%= '%d' % skips %> skips</span>
25
+ </strong>
26
+ </p>
27
+
28
+ <div class="progress">
29
+ <div class="progress-bar progress-bar-info" style="width: <%= percent_passes %>%">
30
+ <%= '%d' % percent_passes %>% passed
31
+ </div>
32
+ <div class="progress-bar progress-bar-danger" style="width: <%= percent_errors_failures %>%">
33
+ <%= '%d' % percent_errors_failures %>% failed
34
+ </div>
35
+ <div class="progress-bar progress-bar-warning" style="width: <%= percent_skipps %>%">
36
+ <%= '%d' % percent_skipps %>% skipped
37
+ </div>
38
+ </div>
39
+
40
+
41
+ </div>
42
+
43
+ <% suites.each do |suite| %>
44
+ <div class="panel panel-default">
45
+ <div class="panel-heading"><strong><%= suite[:name] %></strong>
46
+ <span class="pull-right">
47
+ <span class="<%= 'text-info' if (suite[:fail_count] == 0 && suite[:error_count] == 0) %>"><%= '%d' % suite[:test_count] %> tests</span>,
48
+ <span class="<%= 'text-info' if (failures == 0 && errors == 0) %>"> <%= '%d' % suite[:assertion_count] %> assertions</span>,
49
+ <span class="<%= 'text-danger' if suite[:fail_count] > 0 %>"> <%= '%d' % suite[:fail_count] %> failures</span>,
50
+ <span class="<%= 'text-danger' if suite[:error_count] > 0 %>"> <%= '%d' % suite[:error_count] %> errors</span>,
51
+ <span class="<%= 'text-warning' if suite[:skip_count] > 0 %>"> <%= '%d' % suite[:skip_count] %> skips</span>,
52
+ <span> finished in <%= '%.4fs' % suite[:time] %></span>
53
+ </span>
54
+ </div>
55
+ <div class="panel-body">
56
+ <div class="list-group">
57
+ <% suite[:tests].each do |test| %>
58
+ <div class="list-group-item">
59
+ <h5 class="list-group-item-heading">
60
+ <% if result(test) == :pass %>
61
+ <span class="glyphicon glyphicon-ok text-info" aria-hidden="true"></span>
62
+ <% elsif result(test) == :skip %>
63
+ <span class="glyphicon glyphicon-ban-circle text-warning" aria-hidden="true"></span>
64
+ <% else %>
65
+ <span class="glyphicon glyphicon-remove text-danger" aria-hidden="true"></span>
66
+ <% end %>
67
+ <%= friendly_name(test) %>
68
+ <span class="pull-right">
69
+ Assertions <%= test.assertions %>, time <%= ('%.6fs' % test.time) %>
70
+ </span>
71
+ </h5>
72
+ <% if !test.passed? %>
73
+ <pre class="list-group-item-text"><%= "#{location(test.failure)}\n\n#{test.failure.message}" %></pre>
74
+ <% end %>
75
+ </div>
76
+ <% end %>
77
+ </div>
78
+ </div>
79
+ </div>
80
+ <% end %>
81
+ </div>
82
+ </body>
83
83
  </html>
@@ -1,32 +1,31 @@
1
- # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path('../lib', __FILE__)
3
- require 'minitest/reporters/version'
4
-
5
- Gem::Specification.new do |s|
6
- s.name = 'minitest-reporters'
7
- s.version = Minitest::Reporters::VERSION
8
- s.platform = Gem::Platform::RUBY
9
- s.authors = ['Alexander Kern']
10
- s.email = ['alex@kernul.com']
11
- s.homepage = 'https://github.com/CapnKernul/minitest-reporters'
12
- s.summary = %q{Create customizable Minitest output formats}
13
- s.description = %q{Death to haphazard monkey-patching! Extend Minitest through simple hooks.}
14
- s.license = 'MIT'
15
-
16
- s.required_ruby_version = '>= 1.9.3'
17
- s.rubyforge_project = 'minitest-reporters'
18
-
19
- s.add_dependency 'minitest', '>= 5.0'
20
- s.add_dependency 'ansi'
21
- s.add_dependency 'ruby-progressbar'
22
- s.add_dependency 'builder'
23
-
24
- s.add_development_dependency 'maruku'
25
- s.add_development_dependency 'rake'
26
- s.add_development_dependency 'rubocop'
27
-
28
- s.files = `git ls-files`.split("\n")
29
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
30
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
31
- s.require_paths = ['lib']
32
- end
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path('../lib', __FILE__)
3
+ require 'minitest/reporters/version'
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = 'minitest-reporters'
7
+ s.version = Minitest::Reporters::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ['Alexander Kern']
10
+ s.email = ['alex@kernul.com']
11
+ s.homepage = 'https://github.com/CapnKernul/minitest-reporters'
12
+ s.summary = %q{Create customizable Minitest output formats}
13
+ s.description = %q{Death to haphazard monkey-patching! Extend Minitest through simple hooks.}
14
+ s.license = 'MIT'
15
+
16
+ s.required_ruby_version = '>= 1.9.3'
17
+
18
+ s.add_dependency 'minitest', '>= 5.0'
19
+ s.add_dependency 'ansi'
20
+ s.add_dependency 'ruby-progressbar'
21
+ s.add_dependency 'builder'
22
+
23
+ s.add_development_dependency 'maruku'
24
+ s.add_development_dependency 'rake'
25
+ s.add_development_dependency 'rubocop'
26
+
27
+ s.files = `git ls-files`.split("\n")
28
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
29
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
30
+ s.require_paths = ['lib']
31
+ end
@@ -1,41 +1,41 @@
1
- # This is a test for a bug that was happening when the JUnit Reporter was
2
- # creating filenames from `describe`s that contained slashes, which would crash
3
- # since it was trying to create directories then.
4
-
5
- require 'bundler/setup'
6
- require 'minitest/autorun'
7
- require 'minitest/reporters'
8
-
9
- Minitest::Reporters.use! Minitest::Reporters::JUnitReporter.new
10
-
11
- describe 'something/other' do
12
- it 'does something' do
13
- 1.must_equal 1
14
- end
15
- end
16
-
17
- describe 'something/other' do
18
- it 'does something else' do
19
- 1.must_equal 2
20
- end
21
- end
22
-
23
- class Eval
24
- class Issue258Tset < Minitest::Test
25
- def test_true
26
- assert true
27
- end
28
-
29
- [
30
- ["bool1", "true", "true"],
31
- ["bool2", "false", "false"]
32
- ].each do |a|
33
- (type, expectation1, expectation2) = a
34
- eval(%{
35
- def test_eval_#{type}_#{expectation1}
36
- assert_equal(#{expectation1}, #{expectation2})
37
- end
38
- })
39
- end
40
- end
41
- end
1
+ # This is a test for a bug that was happening when the JUnit Reporter was
2
+ # creating filenames from `describe`s that contained slashes, which would crash
3
+ # since it was trying to create directories then.
4
+
5
+ require 'bundler/setup'
6
+ require 'minitest/autorun'
7
+ require 'minitest/reporters'
8
+
9
+ Minitest::Reporters.use! Minitest::Reporters::JUnitReporter.new
10
+
11
+ describe 'something/other' do
12
+ it 'does something' do
13
+ 1.must_equal 1
14
+ end
15
+ end
16
+
17
+ describe 'something/other' do
18
+ it 'does something else' do
19
+ 1.must_equal 2
20
+ end
21
+ end
22
+
23
+ class Eval
24
+ class Issue258Tset < Minitest::Test
25
+ def test_true
26
+ assert true
27
+ end
28
+
29
+ [
30
+ ["bool1", "true", "true"],
31
+ ["bool2", "false", "false"]
32
+ ].each do |a|
33
+ (type, expectation1, expectation2) = a
34
+ eval(%{
35
+ def test_eval_#{type}_#{expectation1}
36
+ assert_equal(#{expectation1}, #{expectation2})
37
+ end
38
+ })
39
+ end
40
+ end
41
+ end
@@ -1,36 +1,36 @@
1
- require 'bundler/setup'
2
- require 'minitest/autorun'
3
- require 'minitest/reporters'
4
- require 'minitest/reporters/mean_time_reporter'
5
-
6
- Minitest::Reporters.use! Minitest::Reporters::MeanTimeReporter.new
7
-
8
- class TestClass < Minitest::Test
9
- def test_assertion
10
- assert true
11
- end
12
-
13
- def test_fail
14
- fail
15
- end
16
- end
17
-
18
- class AnotherTestClass < Minitest::Test
19
- def test_assertion
20
- assert true
21
- end
22
-
23
- def test_fail
24
- fail
25
- end
26
- end
27
-
28
- class LastTestClass < Minitest::Test
29
- def test_assertion
30
- assert true
31
- end
32
-
33
- def test_fail
34
- fail
35
- end
36
- end
1
+ require 'bundler/setup'
2
+ require 'minitest/autorun'
3
+ require 'minitest/reporters'
4
+ require 'minitest/reporters/mean_time_reporter'
5
+
6
+ Minitest::Reporters.use! Minitest::Reporters::MeanTimeReporter.new
7
+
8
+ class TestClass < Minitest::Test
9
+ def test_assertion
10
+ assert true
11
+ end
12
+
13
+ def test_fail
14
+ fail
15
+ end
16
+ end
17
+
18
+ class AnotherTestClass < Minitest::Test
19
+ def test_assertion
20
+ assert true
21
+ end
22
+
23
+ def test_fail
24
+ fail
25
+ end
26
+ end
27
+
28
+ class LastTestClass < Minitest::Test
29
+ def test_assertion
30
+ assert true
31
+ end
32
+
33
+ def test_fail
34
+ fail
35
+ end
36
+ end