minitest-reporters 1.4.0 → 1.5.0

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: 4a0d617bd5555dc8aa2251bb8e6351700ac826b81c76a4146aa46c4de04bf37c
4
- data.tar.gz: e1b2ab8a11ae00a613b75134008c6be55a0efb53c42c186346e40a90f76546e3
3
+ metadata.gz: 2e6b7a770ddd1f72abb68531badb27cb13fc38189c0f638d91b7244c5a2856c9
4
+ data.tar.gz: 44b074935fd563c3be78833b59a5aba4c0faad662b5adb6d531f4adc7180bd62
5
5
  SHA512:
6
- metadata.gz: 89af1791568eb12157ee3d438a27f97dbecad07d5c92a9bc307c21b1079b584444384107acac7c8b972962c3fe3ba66b77a749aa1e836c2e8c924c1fb79f9a76
7
- data.tar.gz: 1a5698902d3237adc9711b68732fe3b6029a33ab2e79dd720261b5bec9689fc83767c4d91b3f4f71280b19abdd626b6429dfb44a389eab36892f66f9ab9e43e2
6
+ metadata.gz: 9cee23ccb7b443ef4fefea6a8420e3452d171d0c544b6835c1442658616a5db513182ba1dc77731259050fc2431b47e318ff0c116d4a20d7a592bba100b9837e
7
+ data.tar.gz: 216c4f9cabcb7d43304266c3bbb83bf033ad84686bc7258f8c6b6f5dd9970fdc6fc66655bf76e94f27728bd0afb924ef030e29fc8a9a75753f0f879487f9a47a
data/CHANGELOG.md CHANGED
@@ -1,30 +1,52 @@
1
- ### [dev](https://github.com/kern/minitest-reporters/compare/v1.4.0...master)
1
+ ### [dev](https://github.com/kern/minitest-reporters/compare/v1.5.0...master)
2
2
 
3
- ### [1.4.0](https://github.com/kern/minitest-reporters/compare/v1.4.0.beta1...v1.4.0)
3
+ ### [1.5.0](https://github.com/kern/minitest-reporters/compare/v1.4.3...v1.5.0)
4
+
5
+ * Added support for environment variables to define the output location of HTML reports. [#311](https://github.com/minitest-reporters/minitest-reporters/pull/311) contributed by [estebanbouza](https://github.com/estebanbouza)
6
+ * Fixed ProgressReporter accuracy on skipped tests while `detailed_skip` is disabled [#312](https://github.com/minitest-reporters/minitest-reporters/pull/312) contributed by [seven1m](https://github.com/seven1m)
7
+ * Added `file` attribute to `<testcase>` tags in JUnitReporter for CircleCI compatibility [#313](https://github.com/minitest-reporters/minitest-reporters/pull/313) contributed by [nbudin](https://github.com/nbudin)
8
+ * Added timestamp option to JUnitReporter [#316] (https://github.com/minitest-reporters/minitest-reporters/pull/316) contributed by [sipani909](https://github.com/sipani909)
9
+
10
+ ### [1.4.3](https://github.com/kern/minitest-reporters/compare/v1.4.2...v1.4.3)
11
+
12
+ * fixed rare compatability issue between JUnitReporter and older versions of Minitest [#272](https://github.com/minitest-reporters/minitest-reporters/pull/272) contributed by [chakrit](https://github.com/chakrit)
13
+ * fixed JUnitReporter to use a relative file path if a file path is absolute [#305](https://github.com/minitest-reporters/minitest-reporters/issues/305)
14
+ * fixed MeanTimeReporter to reset by deleting previous run file [#296](https://github.com/kern/minitest-reporters/pull/296) contributed by [AnythonyClark](https://github.com/AnthonyClark)
15
+ * removed debug output from ProgressReporter [#301](https://github.com/kern/minitest-reporters/pull/301) contributed by [wvanbergen](https://github.com/wvanbergen)
16
+
17
+ ### [1.4.2](https://github.com/kern/minitest-reporters/compare/v1.4.1...v1.4.2) (2019-10-26)
18
+
19
+ * fixed DelegateReporter to delegate prerecord() [#294](https://github.com/kern/minitest-reporters/pull/294) contributed by [mame](https://github.com/mame)
20
+
21
+ ### [1.4.1](https://github.com/kern/minitest-reporters/compare/v1.4....v1.4.1) (2019-10-10)
22
+
23
+ * fixed Time.current replaced with Time.now in HTML reporter's remplate [#293](https://github.com/kern/minitest-reporters/issues/293)
24
+
25
+ ### [1.4.0](https://github.com/kern/minitest-reporters/compare/v1.4.0.beta1...v1.4.0) (2019-10-06)
4
26
 
5
27
  * travis updated to include ruby 2.6 ([#292](https://github.com/kern/minitest-reporters/pull/292) contributed by [pvalena](https://github.com/pvalena))
6
28
  * location option added to DefaultReporter [#288](https://github.com/kern/minitest-reporters/pull/288) contributed by [bmo](https://github.com/bmo)
7
29
  * Date and time added to HTML report [#287](https://github.com/kern/minitest-reporters/pull/287) contributed by [cderche](https://github.com/cderche)
8
30
 
9
- ### [1.4.0.beta1](https://github.com/kern/minitest-reporters/compare/v1.3.8...v1.4.0.beta1)
31
+ ### [1.4.0.beta1](https://github.com/kern/minitest-reporters/compare/v1.3.8...v1.4.0.beta1) (2019-08-28)
10
32
 
11
33
  * JUnitReporter changed to be compatible with the spec [#286](https://github.com/kern/minitest-reporters/pull/286) contributed by [dylanahsmith](https://github.com/dylanahsmith)
12
34
 
13
- ### [1.3.8](https://github.com/kern/minitest-reporters/compare/v1.3.7...v1.3.8)
35
+ ### [1.3.8](https://github.com/kern/minitest-reporters/compare/v1.3.7...v1.3.8) (2019-08-14)
14
36
 
15
37
  * Fixed default ProgressReporter regression from [#278](https://github.com/kern/minitest-reporters/pull/278); fix [#284](https://github.com/kern/minitest-reporters/pull/284) contributed by [bobmaerten](https://github.com/bobmaerten)
16
38
 
17
- ### [1.3.7](https://github.com/kern/minitest-reporters/compare/v1.3.6...v1.3.7)
39
+ ### [1.3.7](https://github.com/kern/minitest-reporters/compare/v1.3.6...v1.3.7) (2019-08-14)
18
40
 
19
41
  * added ability to specify output dir of JUnitReporter through ENV [#277](https://github.com/kern/minitest-reporters/pull/277) countributed by [KevinSjoberg](https://github.com/KevinSjoberg)
20
42
  * Added verbose functionality to ProgressReporter [#278](https://github.com/kern/minitest-reporters/pull/278) contributed by [senhalil](https://github.com/senhalil)
21
43
 
22
- ### [1.3.6](https://github.com/kern/minitest-reporters/compare/v1.3.5...v1.3.6)
44
+ ### [1.3.6](https://github.com/kern/minitest-reporters/compare/v1.3.5...v1.3.6) (2019-01-16)
23
45
 
24
46
  * fixed possible null pointer in #after_suite [#274](https://github.com/kern/minitest-reporters/pull/274)
25
47
  contributed by [casperisfine](https://github.com/casperisfine)
26
48
 
27
- ### [1.3.5](https://github.com/kern/minitest-reporters/compare/v1.3.5.beta1...v1.3.5)
49
+ ### [1.3.5](https://github.com/kern/minitest-reporters/compare/v1.3.5.beta1...v1.3.5) (2018-09-30)
28
50
 
29
51
  ### [1.3.5.beta1](https://github.com/kern/minitest-reporters/compare/v1.3.4...v1.3.5.beta1)
30
52
 
@@ -49,7 +71,7 @@
49
71
 
50
72
  * SpecReporter do not print exception name any more (unless it is an test error) [#264](https://github.com/kern/minitest-reporters/issues/264)
51
73
  * Fixed loading error caused by fix for [#265](https://github.com/kern/minitest-reporters/pull/265)
52
- see [#267](https://github.com/kern/minitest-reporters/issues/267) and
74
+ see [#267](https://github.com/kern/minitest-reporters/issues/267) and
53
75
  [#268](https://github.com/kern/minitest-reporters/pull/268) for more details.
54
76
 
55
77
  ### [1.3.1](https://github.com/kern/minitest-reporters/compare/v1.3.1.beta1...v1.3.1)
@@ -108,5 +130,3 @@
108
130
  ## [1.1.15](https://github.com/kern/minitest-reporters/compare/v1.1.14...v1.1.15)
109
131
 
110
132
  * Fixed problem with handling SIGINFO [#231](https://github.com/kern/minitest-reporters/pull/231) (contributed by [joshpencheon](https://github.com/joshpencheon))
111
-
112
-
data/README.md CHANGED
@@ -3,7 +3,6 @@
3
3
 
4
4
  # minitest-reporters - create customizable Minitest output formats
5
5
 
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
6
  [![Gem Version](https://badge.fury.io/rb/minitest-reporters.svg)][gem]
8
7
  [![Build Status](https://secure.travis-ci.org/kern/minitest-reporters.png)][travis]
9
8
  [![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)
@@ -37,7 +36,7 @@ Want to use multiple reporters?
37
36
  Minitest::Reporters.use! [Minitest::Reporters::SpecReporter.new, Minitest::Reporters::JUnitReporter.new]
38
37
  ```
39
38
 
40
- If RubyMate, TeamCity, RubyMine or VIM presence is detected, the reporter will be automatically chosen,
39
+ If TextMate, TeamCity, RubyMine or VIM presence is detected, the reporter will be automatically chosen,
41
40
  regardless of any reporters passed to the `use!` method.
42
41
 
43
42
  To override this behavior, you may set the ENV variable MINITEST_REPORTER:
@@ -46,7 +45,7 @@ To override this behavior, you may set the ENV variable MINITEST_REPORTER:
46
45
  export MINITEST_REPORTER=JUnitReporter
47
46
  ```
48
47
 
49
- Detection of those systems is based on presence of certain ENV variables and are evaulated in the following order:
48
+ Detection of those systems is based on presence of certain ENV variables and are evaluated in the following order:
50
49
 
51
50
  ```
52
51
  MINITEST_REPORTER => use reporter indicated in env variable
@@ -117,6 +116,10 @@ The third parameter to `.use!`, in this case `Minitest.backtrace_filter`, should
117
116
  filter object. In the above example, you're telling minitest-reporters to use the filter
118
117
  that Rails has already set.
119
118
 
119
+ **Test Anything Protocol (TAP)**
120
+
121
+ The [Test Anything Protocol](https://testanything.org) is a specification for outputting test results in an implementation-agnostic manner so that various tools can read the output. If you need to produce TAP-compliant output for Minitest results, see this [blog post](https://dev.to/davidwessman/rails-minitest-results-output-in-tap-format-for-heroku-ci-46d3) and [gist](https://gist.github.com/davidwessman/09a13840a8a80080e3842ac3051714c7) by [@davidwessman](https://github.com/davidwessman).
122
+
120
123
  ## Note on Patches/Pull Requests ##
121
124
 
122
125
  * Fork the project.
@@ -16,6 +16,12 @@ module Minitest
16
16
  all_reporters.each(&:start)
17
17
  end
18
18
 
19
+ def prerecord(klass, name)
20
+ all_reporters.each do |reporter|
21
+ reporter.prerecord klass, name
22
+ end
23
+ end
24
+
19
25
  def record(result)
20
26
  all_reporters.each do |reporter|
21
27
  reporter.record result
@@ -60,9 +60,9 @@ module Minitest
60
60
  defaults = {
61
61
  :title => 'Test Results',
62
62
  :erb_template => "#{File.dirname(__FILE__)}/../templates/index.html.erb",
63
- :reports_dir => 'test/html_reports',
63
+ :reports_dir => ENV['MINITEST_HTML_REPORTS_DIR'] || 'test/html_reports',
64
64
  :mode => :safe,
65
- :output_filename => 'index.html',
65
+ :output_filename => ENV['MINITEST_HTML_REPORTS_FILENAME'] || 'index.html',
66
66
  }
67
67
 
68
68
  settings = defaults.merge(args)
@@ -3,6 +3,8 @@
3
3
  require 'builder'
4
4
  require 'fileutils'
5
5
  require 'pathname'
6
+ require 'time'
7
+
6
8
  module Minitest
7
9
  module Reporters
8
10
  # A reporter for writing JUnit test reports
@@ -21,6 +23,7 @@ module Minitest
21
23
  @reports_path = File.absolute_path(ENV.fetch("MINITEST_REPORTERS_REPORTS_DIR", reports_dir))
22
24
  @single_file = options[:single_file]
23
25
  @base_path = options[:base_path] || Dir.pwd
26
+ @timestamp_report = options[:include_timestamp]
24
27
 
25
28
  return unless empty
26
29
 
@@ -61,14 +64,18 @@ module Minitest
61
64
  def get_relative_path(result)
62
65
  file_path = Pathname.new(get_source_location(result).first)
63
66
  base_path = Pathname.new(@base_path)
64
- file_path.relative_path_from(base_path) if file_path.absolute?
65
- file_path
67
+
68
+ if file_path.absolute?
69
+ file_path.relative_path_from(base_path)
70
+ else
71
+ file_path
72
+ end
66
73
  end
67
74
 
68
75
  private
69
76
 
70
77
  def get_source_location(result)
71
- if result.respond_to? :klass
78
+ if result.respond_to? :source_location
72
79
  result.source_location
73
80
  else
74
81
  result.method(result.name).source_location
@@ -79,15 +86,31 @@ module Minitest
79
86
  suite_result = analyze_suite(tests)
80
87
  file_path = get_relative_path(tests.first)
81
88
 
82
- xml.testsuite(:name => suite, :filepath => file_path,
83
- :skipped => suite_result[:skip_count], :failures => suite_result[:fail_count],
84
- :errors => suite_result[:error_count], :tests => suite_result[:test_count],
85
- :assertions => suite_result[:assertion_count], :time => suite_result[:time]) do
86
- tests.each do |test|
87
- lineno = get_source_location(test).last
88
- xml.testcase(:name => test.name, :lineno => lineno, :classname => suite, :assertions => test.assertions,
89
- :time => test.time) do
90
- xml << xml_message_for(test) unless test.passed?
89
+ if @timestamp_report
90
+ xml.testsuite(:name => suite, :filepath => file_path,
91
+ :skipped => suite_result[:skip_count], :failures => suite_result[:fail_count],
92
+ :errors => suite_result[:error_count], :tests => suite_result[:test_count],
93
+ :assertions => suite_result[:assertion_count], :time => suite_result[:time],
94
+ :timestamp => suite_result[:timestamp]) do
95
+ tests.each do |test|
96
+ lineno = get_source_location(test).last
97
+ xml.testcase(:name => test.name, :lineno => lineno, :classname => suite, :assertions => test.assertions,
98
+ :time => test.time, :file => file_path) do
99
+ xml << xml_message_for(test) unless test.passed?
100
+ end
101
+ end
102
+ end
103
+ else
104
+ xml.testsuite(:name => suite, :filepath => file_path,
105
+ :skipped => suite_result[:skip_count], :failures => suite_result[:fail_count],
106
+ :errors => suite_result[:error_count], :tests => suite_result[:test_count],
107
+ :assertions => suite_result[:assertion_count], :time => suite_result[:time]) do
108
+ tests.each do |test|
109
+ lineno = get_source_location(test).last
110
+ xml.testcase(:name => test.name, :lineno => lineno, :classname => suite, :assertions => test.assertions,
111
+ :time => test.time, :file => file_path) do
112
+ xml << xml_message_for(test) unless test.passed?
113
+ end
91
114
  end
92
115
  end
93
116
  end
@@ -150,6 +173,7 @@ module Minitest
150
173
  result[:assertion_count] += test.assertions
151
174
  result[:test_count] += 1
152
175
  result[:time] += test.time
176
+ result[:timestamp] = Time.now.iso8601 if @timestamp_report
153
177
  end
154
178
  result
155
179
  end
@@ -100,7 +100,7 @@ module Minitest
100
100
  #
101
101
  # @return [void]
102
102
  def reset_statistics!
103
- File.open(previous_runs_filename, 'w+') { |f| f.write('') }
103
+ File.delete(previous_runs_filename) if File.exist?(previous_runs_filename)
104
104
  end
105
105
 
106
106
  protected
@@ -48,7 +48,7 @@ module Minitest
48
48
 
49
49
  def record(test)
50
50
  super
51
- return if test.skipped? && !@detailed_skip
51
+ return show if test.skipped? && !@detailed_skip
52
52
  if test.failure
53
53
  print "\e[0m\e[1000D\e[K"
54
54
  print_colored_status(test)
@@ -87,8 +87,7 @@ module Minitest
87
87
  end
88
88
 
89
89
  def print_test_with_time(test)
90
- puts [test.name, test_class(test), total_time].inspect
91
- print(" %s#%s (%.2fs)" % [test.name, test_class(test), total_time])
90
+ print(" %s#%s (%.2fs)" % [test_class(test), test.name, total_time])
92
91
  end
93
92
 
94
93
  def color
@@ -1,5 +1,5 @@
1
1
  module Minitest
2
2
  module Reporters
3
- VERSION = '1.4.0'.freeze
3
+ VERSION = '1.5.0'.freeze
4
4
  end
5
5
  end
@@ -11,7 +11,7 @@
11
11
  <body>
12
12
  <div class="container">
13
13
  <div class="jumbotron">
14
- <h3><small>Generated on <%= Time.current.strftime("%b %d, %Y at %H:%M %Z") %></small></h3>
14
+ <h3><small>Generated on <%= Time.now.strftime("%b %d, %Y at %H:%M %Z") %></small></h3>
15
15
  <h1>
16
16
  <%= title %></h1>
17
17
  <p>
@@ -6,17 +6,17 @@ module MinitestReportersTest
6
6
  fixtures_directory = File.expand_path('../../../fixtures', __FILE__)
7
7
  test_filename = File.join(fixtures_directory, 'progress_test.rb')
8
8
  output = `#{ruby_executable} #{test_filename} 2>&1`
9
- assert_match 'ERROR["test_error"', output, 'Errors should be displayed'
10
- assert_match 'FAIL["test_failure"', output, 'Failures should be displayed'
11
- assert_match 'SKIP["test_skip', output, 'Skipped tests should be displayed'
9
+ assert_match 'test_error', output, 'Errors should be displayed'
10
+ assert_match 'test_failure', output, 'Failures should be displayed'
11
+ assert_match 'test_skip', output, 'Skipped tests should be displayed'
12
12
  end
13
13
  def test_skipped_tests_are_not_displayed
14
14
  fixtures_directory = File.expand_path('../../../fixtures', __FILE__)
15
15
  test_filename = File.join(fixtures_directory, 'progress_detailed_skip_test.rb')
16
16
  output = `#{ruby_executable} #{test_filename} 2>&1`
17
- assert_match 'ERROR["test_error"', output, 'Errors should be displayed'
18
- assert_match 'FAIL["test_failure"', output, 'Failures should be displayed'
19
- refute_match 'SKIP["test_skip', output, 'Skipped tests should not be displayed'
17
+ assert_match 'test_error', output, 'Errors should be displayed'
18
+ assert_match 'test_failure', output, 'Failures should be displayed'
19
+ refute_match 'test_skip', output, 'Skipped tests should not be displayed'
20
20
  end
21
21
  def test_progress_works_with_filter_and_specs
22
22
  fixtures_directory = File.expand_path('../../../fixtures', __FILE__)
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.4.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Kern
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-06 00:00:00.000000000 Z
11
+ date: 2022-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -170,7 +170,7 @@ homepage: https://github.com/CapnKernul/minitest-reporters
170
170
  licenses:
171
171
  - MIT
172
172
  metadata: {}
173
- post_install_message:
173
+ post_install_message:
174
174
  rdoc_options: []
175
175
  require_paths:
176
176
  - lib
@@ -185,26 +185,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
185
185
  - !ruby/object:Gem::Version
186
186
  version: '0'
187
187
  requirements: []
188
- rubygems_version: 3.0.3
189
- signing_key:
188
+ rubygems_version: 3.3.3
189
+ signing_key:
190
190
  specification_version: 4
191
191
  summary: Create customizable Minitest output formats
192
- test_files:
193
- - test/fixtures/junit_filename_bug_example_test.rb
194
- - test/fixtures/mean_time_test.rb
195
- - test/fixtures/progress_detailed_skip_test.rb
196
- - test/fixtures/progress_test.rb
197
- - test/fixtures/sample_test.rb
198
- - test/fixtures/spec_test.rb
199
- - test/gallery/bad_test.rb
200
- - test/gallery/good_test.rb
201
- - test/integration/reporters/junit_reporter_test.rb
202
- - test/integration/reporters/mean_time_reporter_test.rb
203
- - test/integration/reporters/progress_reporter_test.rb
204
- - test/test_helper.rb
205
- - test/unit/minitest/extensible_backtrace_filter_test.rb
206
- - test/unit/minitest/junit_reporter_test.rb
207
- - test/unit/minitest/mean_time_reporter_unit_test.rb
208
- - test/unit/minitest/minitest_reporter_plugin_test.rb
209
- - test/unit/minitest/reporters_test.rb
210
- - test/unit/minitest/spec_reporter_test.rb
192
+ test_files: []