minitest-hyper 0.1.0
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 +7 -0
- data/.gitignore +52 -0
- data/.travis.yml +4 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +49 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/lib/minitest/hyper.rb +4 -0
- data/lib/minitest/hyper/report.rb +63 -0
- data/lib/minitest/hyper/reporter.rb +100 -0
- data/lib/minitest/hyper_plugin.rb +51 -0
- data/lib/templates/hyper.css +111 -0
- data/lib/templates/index.html.erb +101 -0
- data/minitest-hyper.gemspec +25 -0
- metadata +102 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 811a9cc416d40c66ecd0fedc9a529fce0a82a708
|
4
|
+
data.tar.gz: e2c0cde2163ba305e467e5f0639b74fd08c12263
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0cb8b60f1190b02abfabec01868a96cb93952d52370726b346543458a1b32ba4e587049802622768d34598ebfeb76cd10dbc4e9a5f840f6480643cffe9505d02
|
7
|
+
data.tar.gz: 619549060baacfd77b99a98d7e911ff22a0d3b3c9881793b46cd0c9ca46ccadccea4ce541b9af32b97cf2ecce261f4fb987f3bb413ef6fa97f39ceb4fa9343e0
|
data/.gitignore
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
# Editor temporary files
|
2
|
+
#
|
3
|
+
*~
|
4
|
+
\#*\#
|
5
|
+
.\#*
|
6
|
+
*.swp
|
7
|
+
*.swo
|
8
|
+
|
9
|
+
|
10
|
+
# Other common temporary files
|
11
|
+
#
|
12
|
+
*.bak
|
13
|
+
*.old
|
14
|
+
*.orig
|
15
|
+
*.rbc
|
16
|
+
/tmp/*
|
17
|
+
|
18
|
+
|
19
|
+
# Bundler artifacts
|
20
|
+
#
|
21
|
+
/.bundle/
|
22
|
+
/Gemfile.lock
|
23
|
+
/vendor/bundle/
|
24
|
+
|
25
|
+
|
26
|
+
# RubyGems-related artifacts
|
27
|
+
#
|
28
|
+
/*.gem
|
29
|
+
|
30
|
+
|
31
|
+
# Testing artifacts and temp files
|
32
|
+
#
|
33
|
+
/coverage/
|
34
|
+
/test/reports/
|
35
|
+
/test/tmp/
|
36
|
+
**/test/version_tmp
|
37
|
+
|
38
|
+
|
39
|
+
# Documentation
|
40
|
+
#
|
41
|
+
/.yardoc
|
42
|
+
/_yardoc/
|
43
|
+
/doc/
|
44
|
+
/rdoc/
|
45
|
+
|
46
|
+
|
47
|
+
# Keep files
|
48
|
+
#
|
49
|
+
!**/.gitkeep
|
50
|
+
!**/.keep
|
51
|
+
|
52
|
+
|
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Chris Kottom
|
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,49 @@
|
|
1
|
+
# Minitest::Hyper
|
2
|
+
|
3
|
+
Generates attractive, self-contained HTML reports for your Minitest runs.
|
4
|
+
|
5
|
+
This gem was created as a demonstration of how to build a Minitest extension for [The Minitest Cookbook](http://chriskottom.com/minitestcookbook/).
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem "minitest-hyper", require: false
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install minitest-hyper
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
To generate reports using Minitest::Hyper, you'll need to pass the `-H` or `--html` flag to Minitest on the command line in one of the usual ways.
|
26
|
+
|
27
|
+
$ ruby -H test/foo_test.rb
|
28
|
+
$ TEST_OPTS="--html" rake test
|
29
|
+
|
30
|
+
You can also switch on report generation globally for every test run by putting the following in your test helper:
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
require "minitest/hyper"
|
34
|
+
```
|
35
|
+
|
36
|
+
## Development
|
37
|
+
|
38
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
39
|
+
|
40
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
41
|
+
|
42
|
+
## Contributing
|
43
|
+
|
44
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/minitest-hyper. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
45
|
+
|
46
|
+
## License
|
47
|
+
|
48
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
49
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "minitest/hyper"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
require "erb"
|
2
|
+
require "fileutils"
|
3
|
+
|
4
|
+
module Minitest
|
5
|
+
module Hyper
|
6
|
+
class Report
|
7
|
+
attr_reader :reporter
|
8
|
+
|
9
|
+
def initialize(reporter)
|
10
|
+
@reporter = reporter
|
11
|
+
end
|
12
|
+
|
13
|
+
def url
|
14
|
+
"file://#{ REPORT_FILE.gsub(/\\/, "/") }"
|
15
|
+
end
|
16
|
+
|
17
|
+
def write
|
18
|
+
ensure_output_dir
|
19
|
+
move_existing_file
|
20
|
+
write_file
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def ensure_output_dir
|
26
|
+
unless Dir.exist?(REPORTS_DIR)
|
27
|
+
FileUtils.mkdir_p REPORTS_DIR
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def move_existing_file
|
32
|
+
if File.exist?(REPORT_FILE)
|
33
|
+
ctime = File.ctime(REPORT_FILE)
|
34
|
+
time_str = ctime.strftime("%Y%m%d%H%M%S")
|
35
|
+
new_name = REPORT_FILE.sub(/\.html$/, "_#{ time_str }.html")
|
36
|
+
FileUtils.mv(REPORT_FILE, new_name)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def write_file
|
41
|
+
page_info = {
|
42
|
+
title: "Minitest::Hyper Test Report",
|
43
|
+
styles: css_string,
|
44
|
+
timestamp: Time.now
|
45
|
+
}
|
46
|
+
test_info = reporter.to_h
|
47
|
+
|
48
|
+
erb = ERB.new(template_string)
|
49
|
+
File.open(REPORT_FILE, "wb") do |file|
|
50
|
+
file.write erb.result(binding)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def css_string
|
55
|
+
File.read(CSS_TEMPLATE)
|
56
|
+
end
|
57
|
+
|
58
|
+
def template_string
|
59
|
+
File.read(HTML_TEMPLATE)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,100 @@
|
|
1
|
+
require "minitest"
|
2
|
+
|
3
|
+
module Minitest
|
4
|
+
module Hyper
|
5
|
+
class Reporter < Minitest::StatisticsReporter
|
6
|
+
attr_accessor :all_results
|
7
|
+
|
8
|
+
def initialize(io = $stdout, options = {})
|
9
|
+
super
|
10
|
+
self.all_results = []
|
11
|
+
end
|
12
|
+
|
13
|
+
def record(result)
|
14
|
+
super
|
15
|
+
all_results << result
|
16
|
+
end
|
17
|
+
|
18
|
+
def report
|
19
|
+
super
|
20
|
+
@report = Report.new(self)
|
21
|
+
@report.write
|
22
|
+
end
|
23
|
+
|
24
|
+
def passed?
|
25
|
+
super
|
26
|
+
io.puts "Wrote HTML test report to #{ @report.url }"
|
27
|
+
end
|
28
|
+
|
29
|
+
def to_h
|
30
|
+
HashFormatter.as_hash(self)
|
31
|
+
end
|
32
|
+
|
33
|
+
class HashFormatter
|
34
|
+
def self.as_hash(reporter)
|
35
|
+
self.new(reporter).to_h
|
36
|
+
end
|
37
|
+
|
38
|
+
def initialize(reporter)
|
39
|
+
@reporter = reporter
|
40
|
+
end
|
41
|
+
|
42
|
+
def reporter
|
43
|
+
@reporter
|
44
|
+
end
|
45
|
+
|
46
|
+
def to_h
|
47
|
+
{
|
48
|
+
count: reporter.count,
|
49
|
+
assertions: reporter.assertions,
|
50
|
+
start_time: reporter.start_time,
|
51
|
+
total_time: reporter.total_time,
|
52
|
+
failures: reporter.failures,
|
53
|
+
errors: reporter.errors,
|
54
|
+
skips: reporter.skips,
|
55
|
+
results: result_data(reporter.all_results),
|
56
|
+
non_passing: result_data(reporter.results)
|
57
|
+
}
|
58
|
+
end
|
59
|
+
|
60
|
+
def result_data(results)
|
61
|
+
collection = []
|
62
|
+
results.each do |result|
|
63
|
+
collection << {
|
64
|
+
name: result.name,
|
65
|
+
code: result_code(result),
|
66
|
+
class: result_class(result),
|
67
|
+
outcome: result_string(result),
|
68
|
+
time: result.time,
|
69
|
+
assertions: result.assertions,
|
70
|
+
location: result.location,
|
71
|
+
failure: result.failure
|
72
|
+
}
|
73
|
+
end
|
74
|
+
collection
|
75
|
+
end
|
76
|
+
|
77
|
+
def result_code(result)
|
78
|
+
case result.failure
|
79
|
+
when Skip
|
80
|
+
:skip
|
81
|
+
when UnexpectedError
|
82
|
+
:error
|
83
|
+
when Assertion
|
84
|
+
:fail
|
85
|
+
else
|
86
|
+
:pass
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def result_class(result)
|
91
|
+
result_code(result).to_s
|
92
|
+
end
|
93
|
+
|
94
|
+
def result_string(result)
|
95
|
+
result_code(result).to_s.capitalize
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require "minitest"
|
2
|
+
|
3
|
+
require "minitest/hyper/reporter"
|
4
|
+
require "minitest/hyper/report"
|
5
|
+
|
6
|
+
module Minitest
|
7
|
+
# Mandatory Minitest initializer hook
|
8
|
+
# Detected by Minitest.load_plugins, invoked during Minitest.init_plugins
|
9
|
+
def self.plugin_hyper_init(options)
|
10
|
+
if Hyper.enabled?
|
11
|
+
reporter.reporters << Hyper::Reporter.new(options[:io], options)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
# Optional hook for command line params handling
|
16
|
+
# Invoked by Minitest.process_args
|
17
|
+
def self.plugin_hyper_options(opts, options)
|
18
|
+
description = "Generate an HTML test report with Minitest::Hyper"
|
19
|
+
opts.on "-H", "--html", description do
|
20
|
+
Hyper.enable!
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
module Hyper
|
25
|
+
GEM_DIR = File.join(File.dirname(__FILE__), "../..")
|
26
|
+
WORKING_DIR = Dir.pwd
|
27
|
+
|
28
|
+
REPORTS_DIR = File.join(WORKING_DIR, "test/reports/hyper")
|
29
|
+
REPORT_FILE = File.join(REPORTS_DIR, "index.html")
|
30
|
+
|
31
|
+
TEMPLATE_DIR = File.join(GEM_DIR, "lib/templates")
|
32
|
+
CSS_TEMPLATE = File.join(TEMPLATE_DIR, "hyper.css")
|
33
|
+
HTML_TEMPLATE = File.join(TEMPLATE_DIR, "index.html.erb")
|
34
|
+
|
35
|
+
VERSION = "0.1.0"
|
36
|
+
|
37
|
+
@@enabled = false
|
38
|
+
|
39
|
+
def self.enabled?
|
40
|
+
@@enabled
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.enable!
|
44
|
+
@@enabled = true
|
45
|
+
end
|
46
|
+
|
47
|
+
def config(options)
|
48
|
+
@options = options
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,111 @@
|
|
1
|
+
body { padding-top: 70px; }
|
2
|
+
|
3
|
+
.row {
|
4
|
+
margin-bottom: 20px;
|
5
|
+
}
|
6
|
+
|
7
|
+
/*
|
8
|
+
* SUMMARY ROW
|
9
|
+
*/
|
10
|
+
#summary .widget {
|
11
|
+
border: 3px solid #eef;
|
12
|
+
border-radius: 10px;
|
13
|
+
margin-right: 2.5%;
|
14
|
+
padding: 10px;
|
15
|
+
width: 18%;
|
16
|
+
}
|
17
|
+
|
18
|
+
#summary .widget:last-child {
|
19
|
+
margin-right: 0;
|
20
|
+
}
|
21
|
+
|
22
|
+
#summary .counter {
|
23
|
+
display: block;
|
24
|
+
font-size: 4em;
|
25
|
+
font-weight: bold;
|
26
|
+
text-align: center;
|
27
|
+
}
|
28
|
+
|
29
|
+
#summary .metric {
|
30
|
+
display: block;
|
31
|
+
font-size: 1.1em;
|
32
|
+
font-weight: bold;
|
33
|
+
text-align: center;
|
34
|
+
}
|
35
|
+
|
36
|
+
|
37
|
+
/*
|
38
|
+
* INDIVIDUAL TEST RESULTS
|
39
|
+
*/
|
40
|
+
#test-results {
|
41
|
+
margin: 0;
|
42
|
+
}
|
43
|
+
|
44
|
+
#test-results .result {
|
45
|
+
border: solid;
|
46
|
+
border-width: 3px thin;
|
47
|
+
font-size: 14px;
|
48
|
+
margin-bottom: 3px;
|
49
|
+
padding: 6px;
|
50
|
+
width: 100%;
|
51
|
+
}
|
52
|
+
|
53
|
+
#test-results .result span.outcome-name,
|
54
|
+
#test-results .result span.time {
|
55
|
+
display: inline-block;
|
56
|
+
font-size: 15px;
|
57
|
+
font-weight: bold;
|
58
|
+
}
|
59
|
+
|
60
|
+
#test-results .result span.outcome-name {
|
61
|
+
overflow: hidden;
|
62
|
+
max-width: 85%;
|
63
|
+
white-space: nowrap;
|
64
|
+
text-overflow: ellipsis;
|
65
|
+
}
|
66
|
+
|
67
|
+
#test-results .result span.time {
|
68
|
+
float: right;
|
69
|
+
width: 15%;
|
70
|
+
}
|
71
|
+
|
72
|
+
#test-results .result .failure-details {
|
73
|
+
clear: both;
|
74
|
+
}
|
75
|
+
|
76
|
+
#test-results .result.pass {
|
77
|
+
background-color: #eef;
|
78
|
+
border-color: green;
|
79
|
+
font-color: dark-green;
|
80
|
+
}
|
81
|
+
|
82
|
+
#test-results .result.fail {
|
83
|
+
background-color: #ffe4b2;
|
84
|
+
border-color: orange;
|
85
|
+
}
|
86
|
+
|
87
|
+
#test-results .result.error {
|
88
|
+
background-color: #fdd;
|
89
|
+
border-color: red;
|
90
|
+
}
|
91
|
+
|
92
|
+
#test-results .result.skip {
|
93
|
+
background-color: #f0f0f0;
|
94
|
+
border-color: #aaa;
|
95
|
+
}
|
96
|
+
|
97
|
+
|
98
|
+
/*
|
99
|
+
* CHARTS
|
100
|
+
*/
|
101
|
+
#charts h3 {
|
102
|
+
margin: 0;
|
103
|
+
text-align: center;
|
104
|
+
}
|
105
|
+
|
106
|
+
#charts canvas {
|
107
|
+
display: block;
|
108
|
+
height: 300px;
|
109
|
+
margin: 0 auto;
|
110
|
+
width: 90%;
|
111
|
+
}
|
@@ -0,0 +1,101 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
7
|
+
<title><%= page_info[:title] %></title>
|
8
|
+
|
9
|
+
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootswatch/3.3.6/flatly/bootstrap.min.css" rel="stylesheet">
|
10
|
+
<style media="screen" type="text/css">
|
11
|
+
<%= page_info[:styles] %>
|
12
|
+
</style>
|
13
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
|
14
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/js/bootstrap.min.js"></script>
|
15
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.min.js"></script>
|
16
|
+
</head>
|
17
|
+
|
18
|
+
<body>
|
19
|
+
<div id="main">
|
20
|
+
<div class="container">
|
21
|
+
<div id="summary" class="row">
|
22
|
+
<div id="count" class="widget col-md-2">
|
23
|
+
<span class="counter"><%= test_info[:count] %></span>
|
24
|
+
<span class="metric">Tests Run</span>
|
25
|
+
</div>
|
26
|
+
<div id="assertions" class="widget col-md-2">
|
27
|
+
<span class="counter"><%= test_info[:assertions] %></span>
|
28
|
+
<span class="metric">Assertions</span>
|
29
|
+
</div>
|
30
|
+
<div id="failures" class="widget col-md-2">
|
31
|
+
<span class="counter"><%= test_info[:failures] %></span>
|
32
|
+
<span class="metric">Failed</span>
|
33
|
+
</div>
|
34
|
+
<div id="errors" class="widget col-md-2">
|
35
|
+
<span class="counter"><%= test_info[:errors] %></span>
|
36
|
+
<span class="metric">Errors</span>
|
37
|
+
</div>
|
38
|
+
<div id="skips" class="widget col-md-2">
|
39
|
+
<span class="counter"><%= test_info[:skips] %></span>
|
40
|
+
<span class="metric">Skipped</span>
|
41
|
+
</div>
|
42
|
+
</div>
|
43
|
+
|
44
|
+
<div class="row">
|
45
|
+
<h2>Test Results</h2>
|
46
|
+
|
47
|
+
<div id="test-results" class="col-md-8">
|
48
|
+
<% test_info[:results].each do |result| %>
|
49
|
+
<div class="result clearfix <%= result[:class] %>">
|
50
|
+
<span class="outcome-name">
|
51
|
+
<%= result[:outcome].upcase %>: <%= result[:name] %>
|
52
|
+
</span>
|
53
|
+
<span class="time"><%= sprintf("%.2f", result[:time] * 1000.0) %> ms</span>
|
54
|
+
<div class="failure-details">
|
55
|
+
<%= result[:result] %>
|
56
|
+
</div>
|
57
|
+
</div>
|
58
|
+
<% end %>
|
59
|
+
</div>
|
60
|
+
|
61
|
+
<div id="charts" class="col-md-4">
|
62
|
+
<h3>Results by Type</h3>
|
63
|
+
<canvas id="results-by-type"></canvas>
|
64
|
+
</div>
|
65
|
+
</div>
|
66
|
+
</div>
|
67
|
+
</div>
|
68
|
+
<script>
|
69
|
+
// Results by type pie chart
|
70
|
+
var resultsByTypeData = [
|
71
|
+
{
|
72
|
+
label: "Failures",
|
73
|
+
color: "#bd0000",
|
74
|
+
highlight: "#ed0000",
|
75
|
+
value: <%= test_info[:failures] %>
|
76
|
+
},
|
77
|
+
{
|
78
|
+
label: "Errors",
|
79
|
+
color: "#b34100",
|
80
|
+
highlight: "#cc4b00",
|
81
|
+
value: <%= test_info[:errors] %>
|
82
|
+
},
|
83
|
+
{
|
84
|
+
label: "Skips",
|
85
|
+
color: "#006e99",
|
86
|
+
highlight: "#00a8eb",
|
87
|
+
value: <%= test_info[:skips] %>
|
88
|
+
},
|
89
|
+
{
|
90
|
+
label: "Passed",
|
91
|
+
color: "#009e18",
|
92
|
+
highlight: "#00d620",
|
93
|
+
value: <%= test_info[:count] - test_info[:skips] - test_info[:errors] - test_info[:failures] %>
|
94
|
+
}
|
95
|
+
];
|
96
|
+
|
97
|
+
var ctx = document.getElementById("results-by-type").getContext("2d");
|
98
|
+
var resultsByTypeChart = new Chart(ctx).Pie(resultsByTypeData);
|
99
|
+
</script>
|
100
|
+
</body>
|
101
|
+
</html>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'minitest/hyper_plugin'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "minitest-hyper"
|
8
|
+
spec.version = Minitest::Hyper::VERSION
|
9
|
+
spec.authors = ["Chris Kottom"]
|
10
|
+
spec.email = ["chris@chriskottom.com"]
|
11
|
+
|
12
|
+
spec.summary = "Pretty HTML reports for Minitest"
|
13
|
+
spec.description = "Generate attractive, single-page HTML reports for your Minitest runs"
|
14
|
+
spec.homepage = "https://github.com/chriskottom/minitest-hyper"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
23
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
+
spec.add_development_dependency "minitest", "~> 5.8"
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: minitest-hyper
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Chris Kottom
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-12-16 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: '1.10'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.10'
|
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
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '5.8'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '5.8'
|
55
|
+
description: Generate attractive, single-page HTML reports for your Minitest runs
|
56
|
+
email:
|
57
|
+
- chris@chriskottom.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- ".travis.yml"
|
64
|
+
- CODE_OF_CONDUCT.md
|
65
|
+
- Gemfile
|
66
|
+
- LICENSE.txt
|
67
|
+
- README.md
|
68
|
+
- Rakefile
|
69
|
+
- bin/console
|
70
|
+
- bin/setup
|
71
|
+
- lib/minitest/hyper.rb
|
72
|
+
- lib/minitest/hyper/report.rb
|
73
|
+
- lib/minitest/hyper/reporter.rb
|
74
|
+
- lib/minitest/hyper_plugin.rb
|
75
|
+
- lib/templates/hyper.css
|
76
|
+
- lib/templates/index.html.erb
|
77
|
+
- minitest-hyper.gemspec
|
78
|
+
homepage: https://github.com/chriskottom/minitest-hyper
|
79
|
+
licenses:
|
80
|
+
- MIT
|
81
|
+
metadata: {}
|
82
|
+
post_install_message:
|
83
|
+
rdoc_options: []
|
84
|
+
require_paths:
|
85
|
+
- lib
|
86
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
requirements: []
|
97
|
+
rubyforge_project:
|
98
|
+
rubygems_version: 2.4.5.1
|
99
|
+
signing_key:
|
100
|
+
specification_version: 4
|
101
|
+
summary: Pretty HTML reports for Minitest
|
102
|
+
test_files: []
|