minitest-reporters 1.3.2.beta1 → 1.3.2.beta2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3257dd726eea7dfcb07c3945e9066149fcbbd6c5cd8c7d4a05fa259c6f1fc849
4
- data.tar.gz: 266cd94a13ebe4b9899feed855e9831edc03f87e8a137813df4067d15ab73499
3
+ metadata.gz: c72dc8853695e3534ded9072f34e163f80bdd335e971fd40279abf50b6056bb1
4
+ data.tar.gz: 682134ff3cf2d870f474346b6408f99ed592e7c932c69a9d677dd2aa2bbdaf6f
5
5
  SHA512:
6
- metadata.gz: b2c695a962ded855e76c60c55a668f7b0d77d2b111c713367912a61e138f548861cf940877a1410a63d1b91550bc3c18986d28e864ec95b941b79894077aa15f
7
- data.tar.gz: 13d3872725a4bb52c928e5238ebcc90f1e27c2660aaa0e2427860a5d0ec85532248d7e950f77516ff923a0a210f4048545f15c561e18a6c1278061a2579e831b
6
+ metadata.gz: 9d03a331a2474ec6f6882e459a913db53940c09e1f8500c24e0b262b3b793675d1f026fd95306d20f9a3500c2a170747ce18f8bdf609d251b3f3f0192d27dd7d
7
+ data.tar.gz: d8d56e13d1942f73e96737bc7d7bc21a8391c9207048339d345ade31c9bbc0a32be3d32c0937bcd42b8ec64af1c5698dc72cc65182430660550e21b0a9eda005
data/.rubocop.yml CHANGED
@@ -1,8 +1,55 @@
1
+ ---
2
+ #AllCops:
3
+ # DisabledByDefault: true
4
+
5
+ Layout:
6
+ Enabled: true
7
+
8
+ Layout/MultilineOperationIndentation:
9
+ EnforcedStyle: indented
10
+
11
+ Lint:
12
+ Enabled: true
13
+
14
+ Metrics:
15
+ Severity: refactor
16
+ Enabled: true
17
+
1
18
  Metrics/LineLength:
2
- Max: 120
19
+ Severity: convention
20
+ Max: 130
21
+
22
+ Naming:
23
+ Enabled: true
3
24
 
4
25
  Naming/UncommunicativeMethodParamName:
5
26
  MinNameLength: 1
6
27
 
28
+ Performance:
29
+ Enabled: true
30
+
31
+ Rails:
32
+ Enabled: false
33
+
34
+ Security:
35
+ Enabled: true
36
+
37
+ #todo: enable
38
+ Style:
39
+ Enabled: false
40
+
7
41
  Style/FormatStringToken:
8
- Enabled: false
42
+ Enabled: false
43
+
44
+ #todo: enable
45
+ Style/StringLiterals:
46
+ Enabled: false
47
+
48
+ Style/Documentation:
49
+ Enabled: false
50
+
51
+ Bundler:
52
+ Enabled: true
53
+
54
+ Gemspec:
55
+ Enabled: true
data/CHANGELOG.md CHANGED
@@ -1,10 +1,14 @@
1
1
  ### [dev](https://github.com/kern/minitest-reporters/compare/v1.3.2.beta1...master)
2
2
 
3
+ ### [1.3.2.beta2](https://github.com/kern/minitest-reporters/compare/v1.3.2.beta1...v1.3.2.beta2)
4
+
5
+ * fixed the way JUnitReporter calculates relative path [#258](https://github.com/kern/minitest-reporters/issues/258)
6
+
3
7
  ### [1.3.2.beta1](https://github.com/kern/minitest-reporters/compare/v1.3.1...v1.3.2.beta1)
4
8
 
5
- * SpecReporter do not print exception name any more (unless it is an test error) [#264](https://github.com/kern/minitest-reporters/pull/264)
9
+ * SpecReporter do not print exception name any more (unless it is an test error) [#264](https://github.com/kern/minitest-reporters/issues/264)
6
10
  * Fixed loading error caused by fix for [#265](https://github.com/kern/minitest-reporters/pull/265)
7
- see [#267](https://github.com/kern/minitest-reporters/pull/267) and
11
+ see [#267](https://github.com/kern/minitest-reporters/issues/267) and
8
12
  [#268](https://github.com/kern/minitest-reporters/pull/268) for more details.
9
13
 
10
14
  ### [1.3.1](https://github.com/kern/minitest-reporters/compare/v1.3.1.beta1...v1.3.1)
data/README.md CHANGED
@@ -6,6 +6,7 @@
6
6
  [![Join the chat at https://gitter.im/kern/minitest-reporters](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/kern/minitest-reporters?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
7
7
  [![Gem Version](https://badge.fury.io/rb/minitest-reporters.svg)][gem]
8
8
  [![Build Status](https://secure.travis-ci.org/kern/minitest-reporters.png)][travis]
9
+ [![Windows build status](https://ci.appveyor.com/api/projects/status/3pugsxatwcldgyjd/branch/master?svg=true)](https://ci.appveyor.com/project/os97673/minitest-reporters/branch/master)
9
10
 
10
11
  Death to haphazard monkey-patching! Extend Minitest through simple hooks.
11
12
 
data/appveyor.yml ADDED
@@ -0,0 +1,22 @@
1
+ ---
2
+ version: '#{build}'
3
+ cache:
4
+ - vendor/bundle
5
+ environment:
6
+ matrix:
7
+ - RUBY_VERSION: 25-x64
8
+ - RUBY_VERSION: 24-x64
9
+
10
+ install:
11
+ - set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH%
12
+ - bundle install
13
+
14
+ build: off
15
+
16
+ before_test:
17
+ - ruby -v
18
+ - gem -v
19
+ - bundle -v
20
+
21
+ test_script:
22
+ - bundle exec rake test
@@ -31,6 +31,7 @@ module Minitest
31
31
  end
32
32
 
33
33
  private
34
+
34
35
  # stolen from minitest self.run
35
36
  def total_count(options)
36
37
  filter = options[:filter] || '/./'
@@ -79,7 +79,7 @@ module Minitest
79
79
  end
80
80
 
81
81
  def self.minitest_version
82
- Minitest::VERSION.gsub('.', '').to_i
82
+ Minitest::VERSION.delete('.').to_i
83
83
  end
84
84
 
85
85
  def self.use_old_activesupport_fix!
@@ -2,7 +2,6 @@ module Minitest
2
2
  module Reporters
3
3
  module ANSI
4
4
  module Code
5
-
6
5
  def self.color?
7
6
  return false if ENV['MINITEST_REPORTERS_MONO']
8
7
  color_terminal = ENV['TERM'].to_s.downcase.include?("color")
@@ -19,7 +18,7 @@ module Minitest
19
18
  block_given? ? yield : s
20
19
  end
21
20
 
22
- %w[ red green yellow blue magenta cyan white ].each do |color|
21
+ %w[red green yellow blue magenta cyan white].each do |color|
23
22
  alias_method color, :black
24
23
  end
25
24
 
@@ -13,7 +13,7 @@ module Minitest
13
13
  class BaseReporter < Minitest::StatisticsReporter
14
14
  attr_accessor :tests
15
15
 
16
- def initialize(options={})
16
+ def initialize(options = {})
17
17
  super($stdout, options)
18
18
  self.tests = []
19
19
  end
@@ -40,7 +40,7 @@ module Minitest
40
40
  end
41
41
 
42
42
  # called by our own after hooks
43
- def after_test(test)
43
+ def after_test(_test)
44
44
  end
45
45
 
46
46
  def report
@@ -81,11 +81,11 @@ module Minitest
81
81
 
82
82
  def print_colored_status(test)
83
83
  if test.passed?
84
- print(green { pad_mark( result(test).to_s.upcase ) })
84
+ print(green { pad_mark(result(test).to_s.upcase) })
85
85
  elsif test.skipped?
86
- print(yellow { pad_mark( result(test).to_s.upcase ) })
86
+ print(yellow { pad_mark(result(test).to_s.upcase) })
87
87
  else
88
- print(red { pad_mark( result(test).to_s.upcase ) })
88
+ print(red { pad_mark(result(test).to_s.upcase) })
89
89
  end
90
90
  end
91
91
 
@@ -109,8 +109,8 @@ module Minitest
109
109
  io.print(*args)
110
110
  end
111
111
 
112
- def print_info(e, name=true)
113
- print "#{e.exception.class.to_s}: " if name
112
+ def print_info(e, name = true)
113
+ print "#{e.exception.class}: " if name
114
114
  e.message.each_line { |line| print_with_info_padding(line) }
115
115
 
116
116
  # When e is a Minitest::UnexpectedError, the filtered backtrace is already part of the message printed out
@@ -5,9 +5,11 @@ require 'erb'
5
5
  module Minitest
6
6
  module Reporters
7
7
  # A reporter for generating HTML test reports
8
- # This is recommended to be used with a CI server, where the report is kept as an artifact and is accessible via a shared link
8
+ # This is recommended to be used with a CI server, where the report is kept as an artifact and is accessible via
9
+ # a shared link
9
10
  #
10
- # The reporter sorts the results alphabetically and then by results so that failing and skipped tests are at the top.
11
+ # The reporter sorts the results alphabetically and then by results
12
+ # so that failing and skipped tests are at the top.
11
13
  #
12
14
  # When using Minitest Specs, the number prefix is dropped from the name of the test so that it reads well
13
15
  #
@@ -16,7 +18,6 @@ module Minitest
16
18
  # The report is generated using ERB. A custom ERB template can be provided but it is not required
17
19
  # The default ERB template uses JQuery and Bootstrap, both of these are included by referencing the CDN sites
18
20
  class HtmlReporter < BaseReporter
19
-
20
21
  # The title of the report
21
22
  attr_reader :title
22
23
 
@@ -32,12 +33,12 @@ module Minitest
32
33
 
33
34
  # The percentage of tests that were skipped
34
35
  def percent_skipps
35
- (skips/count.to_f * 100).to_i
36
+ (skips / count.to_f * 100).to_i
36
37
  end
37
38
 
38
39
  # The percentage of tests that failed
39
40
  def percent_errors_failures
40
- ((errors+failures)/count.to_f * 100).to_i
41
+ ((errors + failures) / count.to_f * 100).to_i
41
42
  end
42
43
 
43
44
  # Trims off the number prefix on test names when using Minitest Specs
@@ -57,11 +58,11 @@ module Minitest
57
58
  super({})
58
59
 
59
60
  defaults = {
60
- :title => 'Test Results',
61
- :erb_template => "#{File.dirname(__FILE__)}/../templates/index.html.erb",
62
- :reports_dir => 'test/html_reports',
63
- :mode => :safe,
64
- :output_filename => 'index.html'
61
+ :title => 'Test Results',
62
+ :erb_template => "#{File.dirname(__FILE__)}/../templates/index.html.erb",
63
+ :reports_dir => 'test/html_reports',
64
+ :mode => :safe,
65
+ :output_filename => 'index.html'
65
66
  }
66
67
 
67
68
  settings = defaults.merge(args)
@@ -107,6 +108,7 @@ module Minitest
107
108
  f.write(result)
108
109
  end
109
110
 
111
+ # rubocop:disable Lint/RescueException
110
112
  rescue Exception => e
111
113
  puts 'There was an error writing the HTML report'
112
114
  puts 'This may have been caused by cancelling the test run'
@@ -114,10 +116,11 @@ module Minitest
114
116
  puts 'Use mode => :terse in the HTML reporters constructor to see less detail' if @mode != :terse
115
117
  raise e if @mode != :terse
116
118
  end
117
-
119
+ # rubocop:enable Lint/RescueException
118
120
  end
119
121
 
120
122
  private
123
+
121
124
  def html_file
122
125
  "#{@reports_path}/#{@output_filename}"
123
126
  end
@@ -211,10 +214,10 @@ module Minitest
211
214
  return ('%.2fs' % total_time) if total_time < 1
212
215
 
213
216
  hours = (total_time / (60 * 60)).round
214
- minutes = ((total_time / 60) % 60).round.to_s.rjust(2,'0')
215
- seconds = (total_time % 60).round.to_s.rjust(2,'0')
217
+ minutes = ((total_time / 60) % 60).round.to_s.rjust(2, '0')
218
+ seconds = (total_time % 60).round.to_s.rjust(2, '0')
216
219
 
217
- "#{ hours }h#{ minutes }m#{ seconds }s"
220
+ "#{hours}h#{minutes}m#{seconds}s"
218
221
  end
219
222
  end
220
223
  end
@@ -52,6 +52,13 @@ module Minitest
52
52
  end
53
53
  end
54
54
 
55
+ def get_relative_path(result)
56
+ file_path = Pathname.new(get_source_location(result).first)
57
+ base_path = Pathname.new(@base_path)
58
+ file_path.relative_path_from(base_path) if file_path.absolute?
59
+ file_path
60
+ end
61
+
55
62
  private
56
63
 
57
64
  def get_source_location(result)
@@ -64,11 +71,9 @@ module Minitest
64
71
 
65
72
  def parse_xml_for(xml, suite, tests)
66
73
  suite_result = analyze_suite(tests)
67
- file_path = Pathname.new(get_source_location(tests.first).first)
68
- base_path = Pathname.new(@base_path)
69
- relative_path = file_path.relative_path_from(base_path)
74
+ file_path = get_relative_path(tests.first)
70
75
 
71
- xml.testsuite(:name => suite, :filepath => relative_path,
76
+ xml.testsuite(:name => suite, :filepath => file_path,
72
77
  :skipped => suite_result[:skip_count], :failures => suite_result[:fail_count],
73
78
  :errors => suite_result[:error_count], :tests => suite_result[:test_count],
74
79
  :assertions => suite_result[:assertion_count], :time => suite_result[:time]) do
@@ -144,7 +149,8 @@ module Minitest
144
149
 
145
150
  def filename_for(suite)
146
151
  file_counter = 0
147
- suite_name = suite.to_s[0..240].gsub(/[^a-zA-Z0-9]+/, '-') # restrict max filename length, to be kind to filesystems
152
+ # restrict max filename length, to be kind to filesystems
153
+ suite_name = suite.to_s[0..240].gsub(/[^a-zA-Z0-9]+/, '-')
148
154
  filename = "TEST-#{suite_name}.xml"
149
155
  while File.exist?(File.join(@reports_path, filename)) # restrict number of tries, to avoid infinite loops
150
156
  file_counter += 1
@@ -4,7 +4,6 @@ require 'yaml'
4
4
 
5
5
  module Minitest
6
6
  module Reporters
7
-
8
7
  # This reporter creates a report providing the average (mean), minimum and
9
8
  # maximum times for a test to run. Running this for all your tests will
10
9
  # allow you to:
@@ -23,7 +22,6 @@ module Minitest
23
22
  # rake reset_statistics
24
23
  #
25
24
  class MeanTimeReporter < Minitest::Reporters::DefaultReporter
26
-
27
25
  class InvalidOrder < StandardError; end
28
26
  class InvalidSortColumn < StandardError; end
29
27
 
@@ -385,7 +383,6 @@ module Minitest
385
383
 
386
384
  end
387
385
  end
388
-
389
386
  end
390
387
  end
391
388
  end
@@ -48,7 +48,6 @@ else
48
48
  elsif ::Rake::TeamCity.is_in_buildserver_mode
49
49
  log(@message_factory.create_progress_message("Starting.. (#{total_count} tests)"))
50
50
  end
51
-
52
51
  end
53
52
 
54
53
  def report
@@ -38,7 +38,7 @@ module Minitest
38
38
  puts suite
39
39
  end
40
40
 
41
- def after_suite(suite)
41
+ def after_suite(_suite)
42
42
  puts
43
43
  end
44
44
 
@@ -1,5 +1,5 @@
1
1
  module Minitest
2
2
  module Reporters
3
- VERSION = '1.3.2.beta1'.freeze
3
+ VERSION = '1.3.2.beta2'.freeze
4
4
  end
5
5
  end
@@ -19,3 +19,23 @@ describe 'something/other' do
19
19
  1.must_equal 2
20
20
  end
21
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
@@ -0,0 +1,23 @@
1
+ require_relative "../../test_helper"
2
+
3
+ module MinitestReportersTest
4
+ class JUnitReporterUnitTest < Minitest::Test
5
+ def setup
6
+ @reporter = Minitest::Reporters::JUnitReporter.new(
7
+ "report",
8
+ false,
9
+ :base_apath => Dir.pwd
10
+ )
11
+ @result = Minitest::Result.new("test_name")
12
+ end
13
+
14
+ def test_relative_path
15
+ path = Pathname.new(__FILE__).relative_path_from(Pathname.new(Dir.pwd)).to_s
16
+ @result.source_location = [path, 10]
17
+ relative_path = @reporter.get_relative_path(@result)
18
+ assert_equal path, relative_path.to_s
19
+ end
20
+ end
21
+ end
22
+
23
+
@@ -41,6 +41,7 @@ module MinitestReportersTest
41
41
  def test_report_for_describe_not_using_const
42
42
  klass = describe("whatever") { it("passes") { assert true } }
43
43
  runnable = klass.runnable_methods.first
44
+ @reporter.io = StringIO.new
44
45
 
45
46
  # Run the test
46
47
  result = klass.new(runnable).run
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest-reporters
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2.beta1
4
+ version: 1.3.2.beta2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Kern
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-13 00:00:00.000000000 Z
11
+ date: 2018-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -125,6 +125,7 @@ files:
125
125
  - LICENSE
126
126
  - README.md
127
127
  - Rakefile
128
+ - appveyor.yml
128
129
  - assets/default-reporter.png
129
130
  - assets/mean_time_reporter.png
130
131
  - assets/progress-reporter.png
@@ -160,6 +161,7 @@ files:
160
161
  - test/integration/reporters/progress_reporter_test.rb
161
162
  - test/test_helper.rb
162
163
  - test/unit/minitest/extensible_backtrace_filter_test.rb
164
+ - test/unit/minitest/junit_reporter_test.rb
163
165
  - test/unit/minitest/mean_time_reporter_unit_test.rb
164
166
  - test/unit/minitest/minitest_reporter_plugin_test.rb
165
167
  - test/unit/minitest/reporters_test.rb