minitest-reporters-ordered_spec_reporter 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 25c760836001c888fe6b9d019c89ab55a013b4ec3bd5f206ff2980f0fe9a50d4
4
+ data.tar.gz: ac4fa196c41b0c98f963c3e11c90e9f8abdca8462a2ba0e94f3dfc3702fede39
5
+ SHA512:
6
+ metadata.gz: 13c5595cb6611454d13a8c9ff11b4dbb906d656562a799213022f3ada6b696031fe5678833dfa79885bfab439630e82186b722d757f06bdbe0cc574d2d4ff946
7
+ data.tar.gz: 7bc0c90cb39390e248ceb88be4692204190cd62da2f44cf5e61ff04549a1ba3e0ce837f96b120cd0215d24a675e864e938d2591d560f5a9df22bf70447886404
data/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in minitest-reporters-ordered_spec_reporter.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,30 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ minitest-reporters-ordered_spec_reporter (1.0.0)
5
+ minitest-reporters (~> 1.3.6)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ansi (1.5.0)
11
+ builder (3.2.3)
12
+ minitest (5.11.3)
13
+ minitest-reporters (1.3.6)
14
+ ansi
15
+ builder
16
+ minitest (>= 5.0)
17
+ ruby-progressbar
18
+ rake (10.5.0)
19
+ ruby-progressbar (1.10.0)
20
+
21
+ PLATFORMS
22
+ ruby
23
+
24
+ DEPENDENCIES
25
+ bundler (~> 2.0)
26
+ minitest-reporters-ordered_spec_reporter!
27
+ rake (~> 10.0)
28
+
29
+ BUNDLED WITH
30
+ 2.0.1
data/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Nick Barry
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # Minitest::Reporters::OrderedSpecReporter
2
+
3
+ Modified version of `Minitest::Reporters::SpecReporter` which prints test results in alphabetical order, grouped by test class.
4
+
5
+ This gem makes use of the 'minitest-reporters' library. It modifies the test reporting order, but not Minitest's randomized test execution order.
6
+
7
+ ## Installation
8
+
9
+ Add to an application's Gemfile as a dependency:
10
+
11
+ ```ruby
12
+ gem 'minitest-reporters-ordered_spec_reporter'
13
+ ```
14
+
15
+ Install:
16
+
17
+ ```
18
+ bundle install
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ Load the reporter:
24
+
25
+ ```ruby
26
+ Minitest::Reporters.use! Minitest::Reporters::OrderedSpecReporter.new
27
+ ```
28
+
29
+ For more information, see the [minitest-reporters documentation](https://github.com/kern/minitest-reporters).
30
+
31
+ ### Options
32
+
33
+ The constructor accepts the following options:
34
+
35
+ | option | description | default |
36
+ |-|-|-|
37
+ | `:indentation` | number of indentations to apply to top level test class reports | `0` |
38
+ | `:spaces` | number of spaces per indentation level | `2` |
39
+ | `:truncate` | whether to remove the `test_####_` prefix from each test name | `true` |
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
@@ -0,0 +1,89 @@
1
+ require 'minitest/reporters'
2
+
3
+ module Minitest
4
+ module Reporters
5
+ # inherit from BaseReporter, not SpecReporter, in case the latter is updated
6
+ class OrderedSpecReporter < BaseReporter
7
+ include ANSI::Code
8
+ include RelativePosition
9
+
10
+ def initialize options = {}
11
+ super
12
+ @indentation = options[:indentation] || 0
13
+ @spaces = options[:spaces] || 2
14
+ @truncate = options[:truncate] || true
15
+ end
16
+
17
+ def start
18
+ super
19
+ puts('Started with run options %s' % options[:args])
20
+ puts
21
+ end
22
+
23
+ def report
24
+ super
25
+
26
+ tree = {}
27
+
28
+ self.tests.each do |test|
29
+ branch = tree
30
+
31
+ test.klass.split('::').each do |klass|
32
+ branch = (branch[klass] ||= {})
33
+ end
34
+
35
+ (branch[:tests] ||= []) << test
36
+ end
37
+
38
+ tree.sort.to_h.each { |k, v| print_suite(k, v) }
39
+
40
+ puts
41
+ puts('Finished in %.5fs' % total_time)
42
+ print('%d tests, %d assertions, ' % [count, assertions])
43
+ color = failures.zero? && errors.zero? ? :green : :red
44
+ print(send(color) { '%d failures, %d errors, ' } % [failures, errors])
45
+ print(yellow { '%d skips' } % skips)
46
+ puts
47
+ end
48
+
49
+ protected
50
+
51
+ def print_suite(name, branch, indentation = @indentation)
52
+ branch = branch.sort.to_h
53
+ puts ' ' * indentation * @spaces + name unless name.nil?
54
+
55
+ (branch[:tests] || []).each do |test|
56
+ print ' ' * indentation * @spaces
57
+ print_test(test)
58
+ end
59
+
60
+ branch.each do |k, v|
61
+ print_suite k, v, indentation + 1 unless k == :tests
62
+ end
63
+
64
+ puts if indentation == 0
65
+ end
66
+
67
+ def print_test(test)
68
+ record_print_status(test)
69
+ record_print_failures_if_any(test)
70
+ end
71
+
72
+ def record_print_status(test)
73
+ test_name = test.name.gsub(/^test_: /, 'test:')
74
+ test_name = test_name.gsub(/^test_\d*_/, '') if @truncate
75
+ print pad_test(test_name)
76
+ print_colored_status(test)
77
+ print(" (%.2fs)" % test.time) unless test.time.nil?
78
+ puts
79
+ end
80
+
81
+ def record_print_failures_if_any(test)
82
+ if !test.skipped? && test.failure
83
+ print_info(test.failure, test.error?)
84
+ puts
85
+ end
86
+ end
87
+ end
88
+ end
89
+ end
@@ -0,0 +1,32 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "minitest-reporters-ordered_spec_reporter"
7
+ spec.version = "1.0.0"
8
+ spec.authors = ["Nick Barry"]
9
+ spec.email = ["itsnickbarry@protonmail.ch"]
10
+
11
+ spec.summary = "Deterministically ordered and sorted test results."
12
+ spec.description = "Modified version of `Minitest::Reporters::SpecReporter` which prints test results in alphabetical order, grouped by test class."
13
+ spec.homepage = "https://github.com/itsnickbarry/minitest-reporters-ordered_spec_reporter"
14
+ spec.license = "MIT"
15
+
16
+ if spec.respond_to?(:metadata)
17
+ spec.metadata["homepage_uri"] = spec.homepage
18
+ spec.metadata["source_code_uri"] = spec.homepage
19
+ end
20
+
21
+ # Specify which files should be added to the gem when it is released.
22
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
23
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
24
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
25
+ end
26
+ spec.require_paths = ["lib"]
27
+
28
+ spec.add_development_dependency "bundler", "~> 2.0"
29
+ spec.add_development_dependency "rake", "~> 10.0"
30
+
31
+ spec.add_dependency "minitest-reporters", "~> 1.3.6"
32
+ end
metadata ADDED
@@ -0,0 +1,96 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: minitest-reporters-ordered_spec_reporter
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Nick Barry
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-04-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest-reporters
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 1.3.6
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 1.3.6
55
+ description: Modified version of `Minitest::Reporters::SpecReporter` which prints
56
+ test results in alphabetical order, grouped by test class.
57
+ email:
58
+ - itsnickbarry@protonmail.ch
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".gitignore"
64
+ - Gemfile
65
+ - Gemfile.lock
66
+ - LICENSE.md
67
+ - README.md
68
+ - Rakefile
69
+ - lib/minitest/reporters/ordered_spec_reporter.rb
70
+ - minitest-reporters-ordered_spec_reporter.gemspec
71
+ homepage: https://github.com/itsnickbarry/minitest-reporters-ordered_spec_reporter
72
+ licenses:
73
+ - MIT
74
+ metadata:
75
+ homepage_uri: https://github.com/itsnickbarry/minitest-reporters-ordered_spec_reporter
76
+ source_code_uri: https://github.com/itsnickbarry/minitest-reporters-ordered_spec_reporter
77
+ post_install_message:
78
+ rdoc_options: []
79
+ require_paths:
80
+ - lib
81
+ required_ruby_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ required_rubygems_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ requirements: []
92
+ rubygems_version: 3.0.1
93
+ signing_key:
94
+ specification_version: 4
95
+ summary: Deterministically ordered and sorted test results.
96
+ test_files: []