minitest-reporters 1.2.0.beta1 → 1.2.0.beta2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: adfc5700b67227ab5180b5a2001001bd975c7232
4
- data.tar.gz: 9eee008600469f3a738a908ee9c1993e71a86716
3
+ metadata.gz: 62f787588456a19e8d7f3c259964eb08bb800cb6
4
+ data.tar.gz: 57f0b830502a46809f639a0000ac6b465c94163f
5
5
  SHA512:
6
- metadata.gz: 42c148e215d8260219c66068b84c6d72652e9077ba46a9e84ad1f49e108212a835ab99d85820ffb660d68a9b76e88d6e00efa9f03366ba60607fcfcce0f4eae1
7
- data.tar.gz: b08134e33921394f6affc2c5e60de1339bc607ea31dbd8c06f5e42f20c1fa9df586b345897e4eeb928226163da162d1b63037d926adb182a0e0caa5f6f10110e
6
+ metadata.gz: 850a2e0aa57a50ff1603f4d4aab3904aa57a93eef0d126080879ce8fdac468d1c2dc95df58d1844387af3d79d10398c93653212390b2c5731587a7d8a175ebc3
7
+ data.tar.gz: 7ee01ec3c6f529936d5d762c833980b45758d70b0b34321cb3f8a9a10dd2f48479c2ff674128d7c3cfc81faac330097e5c2eef494d6215b922712a65fd143097
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ### [v1.2.0.beta2](https://github.com/kern/minitest-reporters/compare/v1.2.0.beta1...v1.2.0.beta2)
2
+
3
+ * fixed uninitialized time in junit reporter [#251](https://github.com/kern/minitest-reporters/issues/251)
4
+ * format option added to progress reporter [#240](https://github.com/kern/minitest-reporters/pull/240) (contributed by [jorgesmu](https://github.com/jorgesmu))
5
+ * improved output of junit reporter [#245](https://github.com/kern/minitest-reporters/pull/245) (contributed by [jules2689](https://github.com/jules2689))
6
+
1
7
  ### [1.2.0.beta1](https://github.com/kern/minitest-reporters/compare/v1.1.19...v1.2.0.beta1)
2
8
 
3
9
  * SpecReporter regression for Minitest 5.11.1 fixed [#250](https://github.com/kern/minitest-reporters/pull/250) (contrinuted by [mbround18](https://github.com/mbround18))
@@ -13,6 +13,7 @@ module Minitest
13
13
  super({})
14
14
  @reports_path = File.absolute_path(reports_dir)
15
15
  @single_file = options[:single_file]
16
+ @base_path = options[:base_path] || Dir.pwd
16
17
 
17
18
  if empty
18
19
  puts "Emptying #{@reports_path}"
@@ -28,33 +29,46 @@ module Minitest
28
29
  suites = tests.group_by(&:class)
29
30
 
30
31
  if @single_file
31
- write_xml_file_for("minitest", tests.group_by(&:class).values.flatten)
32
+ xml = Builder::XmlMarkup.new(:indent => 2)
33
+ xml.instruct!
34
+ xml.test_suites do
35
+ suites.each do |suite, tests|
36
+ parse_xml_for(xml, suite, tests)
37
+ end
38
+ end
39
+ File.open(filename_for('minitest'), "w") { |file| file << xml.target! }
32
40
  else
33
41
  suites.each do |suite, tests|
34
- write_xml_file_for(suite, tests)
42
+ xml = Builder::XmlMarkup.new(:indent => 2)
43
+ xml.instruct!
44
+ xml.test_suites do
45
+ parse_xml_for(xml, suite, tests)
46
+ end
47
+ File.open(filename_for(suite), "w") { |file| file << @xml.target! }
35
48
  end
36
49
  end
37
-
38
50
  end
39
51
 
40
52
  private
41
53
 
42
- def write_xml_file_for(suite, tests)
54
+ def parse_xml_for(xml, suite, tests)
43
55
  suite_result = analyze_suite(tests)
56
+ file_path = Pathname.new(tests.first.method(tests.first.name).source_location.first)
57
+ base_path = Pathname.new(@base_path)
58
+ relative_path = file_path.relative_path_from(base_path)
44
59
 
45
- xml = Builder::XmlMarkup.new(:indent => 2)
46
- xml.instruct!
47
- xml.testsuite(:name => suite, :skipped => suite_result[:skip_count], :failures => suite_result[:fail_count],
60
+ xml.testsuite(:name => suite, :filepath => relative_path,
61
+ :skipped => suite_result[:skip_count], :failures => suite_result[:fail_count],
48
62
  :errors => suite_result[:error_count], :tests => suite_result[:test_count],
49
63
  :assertions => suite_result[:assertion_count], :time => suite_result[:time]) do
50
64
  tests.each do |test|
51
- xml.testcase(:name => test.name, :classname => suite, :assertions => test.assertions,
65
+ lineno = test.method(test.name).source_location.last
66
+ xml.testcase(:name => test.name, :lineno => lineno, :classname => suite, :assertions => test.assertions,
52
67
  :time => test.time) do
53
68
  xml << xml_message_for(test) unless test.passed?
54
69
  end
55
70
  end
56
71
  end
57
- File.open(filename_for(suite), "w") { |file| file << xml.target! }
58
72
  end
59
73
 
60
74
  def xml_message_for(test)
@@ -107,6 +121,7 @@ module Minitest
107
121
 
108
122
  def analyze_suite(tests)
109
123
  result = Hash.new(0)
124
+ result[:time] = 0
110
125
  tests.each do |test|
111
126
  result[:"#{result(test)}_count"] += 1
112
127
  result[:assertion_count] += test.assertions
@@ -24,7 +24,7 @@ module Minitest
24
24
  starting_at: count,
25
25
  progress_mark: green(PROGRESS_MARK),
26
26
  remainder_mark: ' ',
27
- format: ' %C/%c: [%B] %p%% %a, %e',
27
+ format: options.fetch(:format, ' %C/%c: [%B] %p%% %a, %e'),
28
28
  autostart: false
29
29
  })
30
30
  end
@@ -1,5 +1,5 @@
1
1
  module Minitest
2
2
  module Reporters
3
- VERSION = '1.2.0.beta1'
3
+ VERSION = '1.2.0.beta2'
4
4
  end
5
5
  end
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: 1.2.0.beta1
4
+ version: 1.2.0.beta2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Kern