minitest-failed 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -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 +58 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/lib/minitest/failed/config.rb +11 -0
- data/lib/minitest/failed/file_reporter.rb +57 -0
- data/lib/minitest/failed/io.rb +20 -0
- data/lib/minitest/failed/tasks.rb +12 -0
- data/lib/minitest/failed/version.rb +5 -0
- data/lib/minitest/failed.rb +28 -0
- data/lib/minitest/failed_plugin.rb +8 -0
- data/lib/minitest/tasks/minitest-failed_tasks.rake +1 -0
- data/minitest-failed.gemspec +34 -0
- metadata +105 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 89b1e41805e7a99eafc8c50314a37d12c7823df0
|
4
|
+
data.tar.gz: 539a831461c9abf1c607bf1269680cca1666bea0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 221a382605d55fc8c38d9cacae98ebb1d920df7bfbd72c4ad092ec7b870a768c820fb39f5a062ffc5cdfaa7c38c238bd28776a59de46816b6cab3eb6097e6f8f
|
7
|
+
data.tar.gz: a15739b62c8d48add3a44af2b6ca5700e84e7af8a9a43d5fd602a01ea397b40e5183e22a3d09838f99a91cd4b12fb484483d942864c793d60d8f22fdddc3c5c4
|
data/.gitignore
ADDED
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 Artem Petrov
|
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,58 @@
|
|
1
|
+
# Minitest::Failed
|
2
|
+
|
3
|
+
Minitest failed test runner
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'minitest-failed'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
gem install minitest-failed
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
add to your Rakefile
|
24
|
+
|
25
|
+
require 'minitest/failed/tasks'
|
26
|
+
|
27
|
+
run tests
|
28
|
+
|
29
|
+
rake test
|
30
|
+
|
31
|
+
then run only failed tests
|
32
|
+
|
33
|
+
rake test:failed
|
34
|
+
or short alias
|
35
|
+
|
36
|
+
rake test:f
|
37
|
+
|
38
|
+
## Inspired by projects:
|
39
|
+
|
40
|
+
https://github.com/fnando/minitest-utils
|
41
|
+
https://github.com/grosser/single_test
|
42
|
+
https://github.com/gma/tconsole
|
43
|
+
https://github.com/qrush/m
|
44
|
+
|
45
|
+
## Development
|
46
|
+
|
47
|
+
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.
|
48
|
+
|
49
|
+
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).
|
50
|
+
|
51
|
+
## Contributing
|
52
|
+
|
53
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/minitest-failed. 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.
|
54
|
+
|
55
|
+
|
56
|
+
## License
|
57
|
+
|
58
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "minitest/failed"
|
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,57 @@
|
|
1
|
+
module Minitest
|
2
|
+
module Failed
|
3
|
+
class FileReporter < Minitest::StatisticsReporter
|
4
|
+
|
5
|
+
def report
|
6
|
+
super
|
7
|
+
failing_results = results.reject(&:skipped?)
|
8
|
+
|
9
|
+
if failing_results.any?
|
10
|
+
replay_commands = failing_results.map { |result| display_replay_command(result) }
|
11
|
+
end
|
12
|
+
IO.write_to_file(replay_commands || [])
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def indent(text)
|
19
|
+
text.gsub(/^/, ' ')
|
20
|
+
end
|
21
|
+
|
22
|
+
def display_replay_command(result)
|
23
|
+
location = find_test_file(result)
|
24
|
+
return if location.empty?
|
25
|
+
|
26
|
+
%[rake TEST=#{location} TESTOPTS="--name=#{result.name}"]
|
27
|
+
end
|
28
|
+
|
29
|
+
def find_test_file(result)
|
30
|
+
filter_backtrace(result.failure.backtrace)
|
31
|
+
.find {|line| line.match(%r((test|spec)/.*?_(test|spec).rb)) }
|
32
|
+
.to_s
|
33
|
+
.gsub(/:\d+.*?$/, '')
|
34
|
+
end
|
35
|
+
|
36
|
+
def backtrace(backtrace)
|
37
|
+
backtrace = filter_backtrace(backtrace).map {|line| location(line, true) }
|
38
|
+
return if backtrace.empty?
|
39
|
+
indent(backtrace.join("\n")).gsub(/^(\s+)/, "\\1# ")
|
40
|
+
end
|
41
|
+
|
42
|
+
def location(location, include_line_number = false)
|
43
|
+
regex = include_line_number ? /^([^:]+:\d+)/ : /^([^:]+)/
|
44
|
+
location = File.expand_path(location[regex, 1])
|
45
|
+
|
46
|
+
return location unless location.start_with?(Dir.pwd)
|
47
|
+
|
48
|
+
location.gsub(%r[^#{Regexp.escape(Dir.pwd)}/], '')
|
49
|
+
end
|
50
|
+
|
51
|
+
def filter_backtrace(backtrace)
|
52
|
+
Minitest.backtrace_filter.filter(backtrace)
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Minitest
|
2
|
+
module Failed
|
3
|
+
class IO
|
4
|
+
class << self
|
5
|
+
def read_from_file
|
6
|
+
File.read(config.file_path) if File.exist?(config.file_path)
|
7
|
+
end
|
8
|
+
|
9
|
+
def write_to_file(results)
|
10
|
+
content = results.join("\n")
|
11
|
+
File.write(config.file_path, content)
|
12
|
+
end
|
13
|
+
|
14
|
+
def config
|
15
|
+
::Minitest::Failed.config
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
namespace :test do
|
2
|
+
|
3
|
+
Rake::TestTask.new(:failed) do |t|
|
4
|
+
files, tests = Minitest::Failed.get_files_and_tests
|
5
|
+
options = "-n'/#{tests.join('|')}/'" if tests
|
6
|
+
t.libs << 'test'
|
7
|
+
t.test_files = files if files
|
8
|
+
t.options = options
|
9
|
+
end
|
10
|
+
|
11
|
+
task f: :failed
|
12
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Minitest
|
2
|
+
module Failed
|
3
|
+
require 'minitest'
|
4
|
+
require 'minitest/failed/version'
|
5
|
+
require 'minitest/failed/config'
|
6
|
+
require 'minitest/failed/file_reporter'
|
7
|
+
require 'minitest/failed/io'
|
8
|
+
|
9
|
+
def self.get_files_and_tests
|
10
|
+
string = IO.read_from_file
|
11
|
+
|
12
|
+
return nil unless string
|
13
|
+
|
14
|
+
array = string.split(/rake|TEST=| TESTOPTS=|\"|\\|--name=/).map(&:strip).reject(&:empty?)
|
15
|
+
array.partition { |v| v.end_with?('rb') }
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.configure
|
19
|
+
@config = Minitest::Failed::Config.new
|
20
|
+
yield @config
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.config
|
24
|
+
@config ||= Minitest::Failed::Config.new
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
load(File.expand_path(File.join(File.dirname(__FILE__), '../failed/tasks.rb')))
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'minitest/failed/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'minitest-failed'
|
8
|
+
spec.version = Minitest::Failed::VERSION
|
9
|
+
spec.authors = ['Artem Petrov']
|
10
|
+
spec.email = ['partos0511@gmail.com']
|
11
|
+
|
12
|
+
spec.summary = %q{Minitest failed test runner}
|
13
|
+
spec.description = spec.summary
|
14
|
+
spec.homepage = 'http://github.com/artempartos/minitest-failed'
|
15
|
+
spec.license = 'MIT'
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
18
|
+
# delete this section to allow pushing this gem to any host.
|
19
|
+
# if spec.respond_to?(:metadata)
|
20
|
+
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
21
|
+
# else
|
22
|
+
# raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
23
|
+
# end
|
24
|
+
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
26
|
+
spec.bindir = "exe"
|
27
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
+
spec.require_paths = ["lib"]
|
29
|
+
|
30
|
+
spec.add_dependency 'minitest'
|
31
|
+
|
32
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
33
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
34
|
+
end
|
metadata
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: minitest-failed
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Artem Petrov
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-12-14 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: minitest
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.10'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.10'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
description: Minitest failed test runner
|
56
|
+
email:
|
57
|
+
- partos0511@gmail.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/failed.rb
|
72
|
+
- lib/minitest/failed/config.rb
|
73
|
+
- lib/minitest/failed/file_reporter.rb
|
74
|
+
- lib/minitest/failed/io.rb
|
75
|
+
- lib/minitest/failed/tasks.rb
|
76
|
+
- lib/minitest/failed/version.rb
|
77
|
+
- lib/minitest/failed_plugin.rb
|
78
|
+
- lib/minitest/tasks/minitest-failed_tasks.rake
|
79
|
+
- minitest-failed.gemspec
|
80
|
+
homepage: http://github.com/artempartos/minitest-failed
|
81
|
+
licenses:
|
82
|
+
- MIT
|
83
|
+
metadata: {}
|
84
|
+
post_install_message:
|
85
|
+
rdoc_options: []
|
86
|
+
require_paths:
|
87
|
+
- lib
|
88
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
requirements: []
|
99
|
+
rubyforge_project:
|
100
|
+
rubygems_version: 2.4.3
|
101
|
+
signing_key:
|
102
|
+
specification_version: 4
|
103
|
+
summary: Minitest failed test runner
|
104
|
+
test_files: []
|
105
|
+
has_rdoc:
|