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
data/Gemfile CHANGED
@@ -1,2 +1,2 @@
1
- source "https://rubygems.org"
2
- gemspec
1
+ source "https://rubygems.org"
2
+ gemspec
data/LICENSE CHANGED
@@ -1,20 +1,20 @@
1
- Copyright (c) 2018 Alexander Kern
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+ Copyright (c) 2018 Alexander Kern
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,135 +1,135 @@
1
- [gem]: https://rubygems.org/gems/minitest-reporters
2
- [travis]: https://travis-ci.org/kern/minitest-reporters
3
-
4
- # minitest-reporters - create customizable Minitest output formats
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
- [![Gem Version](https://badge.fury.io/rb/minitest-reporters.svg)][gem]
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)
10
-
11
- Death to haphazard monkey-patching! Extend Minitest through simple hooks.
12
-
13
- ## Installation ##
14
-
15
- gem install minitest-reporters
16
-
17
- ## Usage ##
18
-
19
- In your `test_helper.rb` file, add the following lines:
20
-
21
- ```ruby
22
- require "minitest/reporters"
23
- Minitest::Reporters.use!
24
- ```
25
-
26
- This will swap out the Minitest runner to the custom one used by minitest-reporters and use the correct reporters for Textmate, Rubymine, and the console. If you would like to write your own reporter, just `include Minitest::Reporter` and override the methods you'd like. Take a look at the provided reporters for examples.
27
-
28
- Don't like the default progress bar reporter?
29
-
30
- ```ruby
31
- Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new
32
- ```
33
-
34
- Want to use multiple reporters?
35
-
36
- ```ruby
37
- Minitest::Reporters.use! [Minitest::Reporters::SpecReporter.new, Minitest::Reporters::JUnitReporter.new]
38
- ```
39
-
40
- If RubyMate, TeamCity, RubyMine or VIM presence is detected, the reporter will be automatically chosen,
41
- regardless of any reporters passed to the `use!` method.
42
-
43
- To override this behavior, you may set the ENV variable MINITEST_REPORTER:
44
-
45
- ```sh
46
- export MINITEST_REPORTER=JUnitReporter
47
- ```
48
-
49
- Detection of those systems is based on presence of certain ENV variables and are evaulated in the following order:
50
-
51
- ```
52
- MINITEST_REPORTER => use reporter indicated in env variable
53
- TM_PID => use RubyMateReporter
54
- RM_INFO => use RubyMineReporter
55
- TEAMCITY_VERSION => use RubyMineReporter
56
- VIM => disable all Reporters
57
- ```
58
-
59
- The following reporters are provided:
60
-
61
- ```ruby
62
- Minitest::Reporters::DefaultReporter # => Redgreen-capable version of standard Minitest reporter
63
- Minitest::Reporters::SpecReporter # => Turn-like output that reads like a spec
64
- Minitest::Reporters::ProgressReporter # => Fuubar-like output with a progress bar
65
- Minitest::Reporters::RubyMateReporter # => Simple reporter designed for RubyMate
66
- Minitest::Reporters::RubyMineReporter # => Reporter designed for RubyMine IDE and TeamCity CI server
67
- Minitest::Reporters::JUnitReporter # => JUnit test reporter designed for JetBrains TeamCity
68
- Minitest::Reporters::MeanTimeReporter # => Produces a report summary showing the slowest running tests
69
- Minitest::Reporters::HtmlReporter # => Generates an HTML report of the test results
70
- ```
71
-
72
- Options can be passed to these reporters at construction-time, e.g. to force
73
- color output from `DefaultReporter`:
74
-
75
- ```ruby
76
- Minitest::Reporters.use! [Minitest::Reporters::DefaultReporter.new(:color => true)]
77
- ```
78
-
79
- ## Screenshots ##
80
-
81
- **Default Reporter**
82
-
83
- ![Default Reporter](./assets/default-reporter.png?raw=true)
84
-
85
- **Spec Reporter**
86
-
87
- ![Spec Reporter](./assets/spec-reporter.png?raw=true)
88
-
89
- **Progress Reporter**
90
-
91
- ![Progress Reporter](./assets/progress-reporter.png?raw=true)
92
-
93
- ## Caveats ##
94
-
95
- If you are using minitest-reporters with ActiveSupport 3.x, make sure that you require ActiveSupport before invoking `Minitest::Reporters.use!`. Minitest-reporters fixes incompatibilities caused by monkey patches in ActiveSupport 3.x. ActiveSupport 4.x is unaffected.
96
-
97
- **Rails Backtrace Filtering and Custom Backtrace Filtering**
98
-
99
- Minitest lets you configures your own, custom backtrace filter via
100
- `Minitest.backtrace_filter=`. If you're using Rails, then by default
101
- `Minitest.backtrace_filter` is a filter designed specially for Rails.
102
-
103
- But minitest-reporters overwrites `Minitest.backtrace_filter` by default. That means it
104
- will overwrite your custom filter and Rails' default filter. (You'll know this is
105
- happening if you see overly long or otherwise unexpected backtraces.)
106
-
107
- To avoid that, you must manually tell minitest-reporters which filter to use. In Rails,
108
- do this in `test_helper.rb`:
109
- ```ruby
110
- Minitest::Reporters.use!(
111
- Minitest::Reporters::DefaultReporter.new,
112
- ENV,
113
- Minitest.backtrace_filter
114
- )
115
- ```
116
- The third parameter to `.use!`, in this case `Minitest.backtrace_filter`, should be a
117
- filter object. In the above example, you're telling minitest-reporters to use the filter
118
- that Rails has already set.
119
-
120
- ## Note on Patches/Pull Requests ##
121
-
122
- * Fork the project.
123
- * Make your feature addition or bug fix.
124
- * Add tests for it. This is important so I don't break it in a future version unintentionally.
125
- * Commit, but do not mess with the `Rakefile`. If you want to have your own version, that is fine but bump the version in a commit by itself in another branch so I can ignore it when I pull.
126
- * Send me a pull request. Bonus points for git flow feature branches.
127
-
128
- ## Resources ##
129
-
130
- * [GitHub Repository](https://github.com/CapnKernul/minitest-reporters)
131
- * [Documentation](http://www.rubydoc.info/github/kern/minitest-reporters/master)
132
-
133
- ## License ##
134
-
135
- Minitest-reporters is licensed under the MIT License. See [LICENSE](LICENSE) for details.
1
+ [gem]: https://rubygems.org/gems/minitest-reporters
2
+ [travis]: https://travis-ci.org/kern/minitest-reporters
3
+
4
+ # minitest-reporters - create customizable Minitest output formats
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
+ [![Gem Version](https://badge.fury.io/rb/minitest-reporters.svg)][gem]
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)
10
+
11
+ Death to haphazard monkey-patching! Extend Minitest through simple hooks.
12
+
13
+ ## Installation ##
14
+
15
+ gem install minitest-reporters
16
+
17
+ ## Usage ##
18
+
19
+ In your `test_helper.rb` file, add the following lines:
20
+
21
+ ```ruby
22
+ require "minitest/reporters"
23
+ Minitest::Reporters.use!
24
+ ```
25
+
26
+ This will swap out the Minitest runner to the custom one used by minitest-reporters and use the correct reporters for Textmate, Rubymine, and the console. If you would like to write your own reporter, just `include Minitest::Reporter` and override the methods you'd like. Take a look at the provided reporters for examples.
27
+
28
+ Don't like the default progress bar reporter?
29
+
30
+ ```ruby
31
+ Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new
32
+ ```
33
+
34
+ Want to use multiple reporters?
35
+
36
+ ```ruby
37
+ Minitest::Reporters.use! [Minitest::Reporters::SpecReporter.new, Minitest::Reporters::JUnitReporter.new]
38
+ ```
39
+
40
+ If RubyMate, TeamCity, RubyMine or VIM presence is detected, the reporter will be automatically chosen,
41
+ regardless of any reporters passed to the `use!` method.
42
+
43
+ To override this behavior, you may set the ENV variable MINITEST_REPORTER:
44
+
45
+ ```sh
46
+ export MINITEST_REPORTER=JUnitReporter
47
+ ```
48
+
49
+ Detection of those systems is based on presence of certain ENV variables and are evaulated in the following order:
50
+
51
+ ```
52
+ MINITEST_REPORTER => use reporter indicated in env variable
53
+ TM_PID => use RubyMateReporter
54
+ RM_INFO => use RubyMineReporter
55
+ TEAMCITY_VERSION => use RubyMineReporter
56
+ VIM => disable all Reporters
57
+ ```
58
+
59
+ The following reporters are provided:
60
+
61
+ ```ruby
62
+ Minitest::Reporters::DefaultReporter # => Redgreen-capable version of standard Minitest reporter
63
+ Minitest::Reporters::SpecReporter # => Turn-like output that reads like a spec
64
+ Minitest::Reporters::ProgressReporter # => Fuubar-like output with a progress bar
65
+ Minitest::Reporters::RubyMateReporter # => Simple reporter designed for RubyMate
66
+ Minitest::Reporters::RubyMineReporter # => Reporter designed for RubyMine IDE and TeamCity CI server
67
+ Minitest::Reporters::JUnitReporter # => JUnit test reporter designed for JetBrains TeamCity
68
+ Minitest::Reporters::MeanTimeReporter # => Produces a report summary showing the slowest running tests
69
+ Minitest::Reporters::HtmlReporter # => Generates an HTML report of the test results
70
+ ```
71
+
72
+ Options can be passed to these reporters at construction-time, e.g. to force
73
+ color output from `DefaultReporter`:
74
+
75
+ ```ruby
76
+ Minitest::Reporters.use! [Minitest::Reporters::DefaultReporter.new(:color => true)]
77
+ ```
78
+
79
+ ## Screenshots ##
80
+
81
+ **Default Reporter**
82
+
83
+ ![Default Reporter](./assets/default-reporter.png?raw=true)
84
+
85
+ **Spec Reporter**
86
+
87
+ ![Spec Reporter](./assets/spec-reporter.png?raw=true)
88
+
89
+ **Progress Reporter**
90
+
91
+ ![Progress Reporter](./assets/progress-reporter.png?raw=true)
92
+
93
+ ## Caveats ##
94
+
95
+ If you are using minitest-reporters with ActiveSupport 3.x, make sure that you require ActiveSupport before invoking `Minitest::Reporters.use!`. Minitest-reporters fixes incompatibilities caused by monkey patches in ActiveSupport 3.x. ActiveSupport 4.x is unaffected.
96
+
97
+ **Rails Backtrace Filtering and Custom Backtrace Filtering**
98
+
99
+ Minitest lets you configures your own, custom backtrace filter via
100
+ `Minitest.backtrace_filter=`. If you're using Rails, then by default
101
+ `Minitest.backtrace_filter` is a filter designed specially for Rails.
102
+
103
+ But minitest-reporters overwrites `Minitest.backtrace_filter` by default. That means it
104
+ will overwrite your custom filter and Rails' default filter. (You'll know this is
105
+ happening if you see overly long or otherwise unexpected backtraces.)
106
+
107
+ To avoid that, you must manually tell minitest-reporters which filter to use. In Rails,
108
+ do this in `test_helper.rb`:
109
+ ```ruby
110
+ Minitest::Reporters.use!(
111
+ Minitest::Reporters::DefaultReporter.new,
112
+ ENV,
113
+ Minitest.backtrace_filter
114
+ )
115
+ ```
116
+ The third parameter to `.use!`, in this case `Minitest.backtrace_filter`, should be a
117
+ filter object. In the above example, you're telling minitest-reporters to use the filter
118
+ that Rails has already set.
119
+
120
+ ## Note on Patches/Pull Requests ##
121
+
122
+ * Fork the project.
123
+ * Make your feature addition or bug fix.
124
+ * Add tests for it. This is important so I don't break it in a future version unintentionally.
125
+ * Commit, but do not mess with the `Rakefile`. If you want to have your own version, that is fine but bump the version in a commit by itself in another branch so I can ignore it when I pull.
126
+ * Send me a pull request. Bonus points for git flow feature branches.
127
+
128
+ ## Resources ##
129
+
130
+ * [GitHub Repository](https://github.com/CapnKernul/minitest-reporters)
131
+ * [Documentation](http://www.rubydoc.info/github/kern/minitest-reporters/master)
132
+
133
+ ## License ##
134
+
135
+ Minitest-reporters is licensed under the MIT License. See [LICENSE](LICENSE) for details.
data/Rakefile CHANGED
@@ -1,70 +1,70 @@
1
- require "bundler/gem_tasks"
2
- require "rake/testtask"
3
- require 'rubocop/rake_task'
4
-
5
- task :default => :test
6
- Rake::TestTask.new do |t|
7
- t.pattern = "test/{unit,integration}/**/*_test.rb"
8
- t.verbose = true
9
- end
10
-
11
- rubymine_home = [
12
- ENV["RUBYMINE_HOME"],
13
- "../rubymine-contrib/ruby-testing/src/rb/testing/patch/common",
14
- "/Applications/RubyMine.app/Contents/rb/testing/patch/common",
15
- ].compact.detect { |d| Dir.exist?(d) }
16
-
17
- Rake::TestTask.new("test:gallery") do |t|
18
- t.pattern = "test/gallery/**/*_test.rb"
19
- t.verbose = true
20
- t.libs << rubymine_home
21
- end
22
-
23
- # - RubyMineReporter must be tested separately inside of RubyMine
24
- # - JUnitReporter normally writes to `test/reports` instead of stdout
25
- task :gallery do
26
- unless rubymine_home
27
- warn "To see RubyMineReporter supply RUBYMINE_HOME= or git clone git://git.jetbrains.org/idea/contrib.git ../rubymine-contrib"
28
- exit 1
29
- end
30
-
31
- [
32
- "Pride",
33
- "DefaultReporter",
34
- "JUnitReporter",
35
- "ProgressReporter",
36
- "RubyMateReporter",
37
- "SpecReporter",
38
- "RubyMineReporter",
39
- "HtmlReporter",
40
- "MeanTimeReporter",
41
- ].each do |reporter|
42
- puts
43
- puts "-" * 72
44
- puts "Running gallery tests using #{reporter}..."
45
- puts "-" * 72
46
- puts
47
-
48
- sh "rake test:gallery REPORTER=#{reporter}" do
49
- # Ignore failures. They're expected when you are running the gallery
50
- # test suite.
51
- end
52
- sh "cat test/reports/*" if reporter == "JUnitReporter"
53
- end
54
- end
55
-
56
- task :reset_statistics do
57
- require 'minitest/reporters/mean_time_reporter'
58
- Minitest::Reporters::MeanTimeReporter.reset_statistics!
59
- puts "The mean time reporter statistics have been reset."
60
- exit 0
61
- end
62
-
63
- desc 'Run RuboCop on the lib directory'
64
- RuboCop::RakeTask.new(:rubocop) do |task|
65
- task.patterns = ['lib/**/*.rb']
66
- # only show the files with failures
67
- task.formatters = ['clang']
68
- # don't abort rake on failure
69
- task.fail_on_error = false
70
- end
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+ require 'rubocop/rake_task'
4
+
5
+ task :default => :test
6
+ Rake::TestTask.new do |t|
7
+ t.pattern = "test/{unit,integration}/**/*_test.rb"
8
+ t.verbose = true
9
+ end
10
+
11
+ rubymine_home = [
12
+ ENV["RUBYMINE_HOME"],
13
+ "../rubymine-contrib/ruby-testing/src/rb/testing/patch/common",
14
+ "/Applications/RubyMine.app/Contents/rb/testing/patch/common",
15
+ ].compact.detect { |d| Dir.exist?(d) }
16
+
17
+ Rake::TestTask.new("test:gallery") do |t|
18
+ t.pattern = "test/gallery/**/*_test.rb"
19
+ t.verbose = true
20
+ t.libs << rubymine_home
21
+ end
22
+
23
+ # - RubyMineReporter must be tested separately inside of RubyMine
24
+ # - JUnitReporter normally writes to `test/reports` instead of stdout
25
+ task :gallery do
26
+ unless rubymine_home
27
+ warn "To see RubyMineReporter supply RUBYMINE_HOME= or git clone git://git.jetbrains.org/idea/contrib.git ../rubymine-contrib"
28
+ exit 1
29
+ end
30
+
31
+ [
32
+ "Pride",
33
+ "DefaultReporter",
34
+ "JUnitReporter",
35
+ "ProgressReporter",
36
+ "RubyMateReporter",
37
+ "SpecReporter",
38
+ "RubyMineReporter",
39
+ "HtmlReporter",
40
+ "MeanTimeReporter",
41
+ ].each do |reporter|
42
+ puts
43
+ puts "-" * 72
44
+ puts "Running gallery tests using #{reporter}..."
45
+ puts "-" * 72
46
+ puts
47
+
48
+ sh "rake test:gallery REPORTER=#{reporter}" do
49
+ # Ignore failures. They're expected when you are running the gallery
50
+ # test suite.
51
+ end
52
+ sh "cat test/reports/*" if reporter == "JUnitReporter"
53
+ end
54
+ end
55
+
56
+ task :reset_statistics do
57
+ require 'minitest/reporters/mean_time_reporter'
58
+ Minitest::Reporters::MeanTimeReporter.reset_statistics!
59
+ puts "The mean time reporter statistics have been reset."
60
+ exit 0
61
+ end
62
+
63
+ desc 'Run RuboCop on the lib directory'
64
+ RuboCop::RakeTask.new(:rubocop) do |task|
65
+ task.patterns = ['lib/**/*.rb']
66
+ # only show the files with failures
67
+ task.formatters = ['clang']
68
+ # don't abort rake on failure
69
+ task.fail_on_error = false
70
+ end