minitest-rerun-failed 0.2.2.pre → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/CHANGELOG.md +4 -1
- data/Gemfile.lock +1 -1
- data/README.md +9 -37
- data/bin/rerun_failed_tests +30 -0
- data/lib/minitest_rerun_failed/version.rb +1 -1
- data/lib/minitest_rerun_failed.rb +0 -1
- data/minitest_rerun_failed.gemspec +3 -3
- metadata +6 -5
- data/assets/screenshot.png +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5fa0915e0ca55a16334ba0b89ad69d41a70af2ce827bc2a0fa31238648c74e6
|
4
|
+
data.tar.gz: 24ca351e6ccb122b59393f67eaa17ada1fe2b1bf907153566e4182ebc0a43f8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f93548ba827aed8b2c0f7a4da516bdc9587e158c26d44f5e3fdb5566d1ddf88ddb25b0a5bb141b89f0d7eaf6baedaa4fbcbc7e9245845368d5a46a524322d9cf
|
7
|
+
data.tar.gz: ab2c9303f580f8936177c0aecb8bc6440d7e64cdac18a63a13e2c5701c4b679c5afea3495389b45cc90edd1429fc7b2b5cb9f32325923ffd377fd415dd80f831
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -12,26 +12,22 @@ Easy rerun of failed tests with minitest. Prints a list of failed tests and seed
|
|
12
12
|
- To console and / or to file
|
13
13
|
- Optionally includes line numbers
|
14
14
|
- Lists seed of run for rerun.
|
15
|
-
-
|
15
|
+
- Executable for running only failed tests
|
16
16
|
- Until done, use something like
|
17
17
|
- `ruby $(cat .minitest_failed_tests.txt)`
|
18
18
|
- `bundle exec rails test $(cat .minitest_failed_tests.txt)`
|
19
19
|
|
20
20
|
## Installation
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
```ruby
|
25
|
-
gem 'minitest-rerun-failed'
|
22
|
+
```
|
23
|
+
bundle add "minitest-rerun-failed" --group test
|
26
24
|
```
|
27
25
|
|
28
|
-
|
29
|
-
|
30
|
-
$ bundle install
|
31
|
-
|
32
|
-
Or install it yourself as:
|
26
|
+
If you want to install the executable to `bin/rerun_failed_tests`:
|
33
27
|
|
34
|
-
|
28
|
+
```
|
29
|
+
bundle binstubs minitest-rerun-failed
|
30
|
+
```
|
35
31
|
|
36
32
|
## Usage
|
37
33
|
|
@@ -40,34 +36,16 @@ Use it like any Minitest::Reporters like such:
|
|
40
36
|
```ruby
|
41
37
|
Minitest::Reporters.use! [
|
42
38
|
Minitest::Reporters::ProgressReporter.new, # This is just my preferred reporter. Use the one(s) you like.
|
43
|
-
Minitest::Reporters::FailedTestsReporter.new
|
39
|
+
Minitest::Reporters::FailedTestsReporter.new
|
44
40
|
]
|
45
41
|
```
|
46
42
|
|
47
|
-
## Rails Usage
|
48
|
-
|
49
|
-
In your `test_helper.rb` file, add the following lines
|
50
|
-
|
51
|
-
```ruby
|
52
|
-
require "minitest_rerun_failed"
|
53
|
-
|
54
|
-
Minitest::Reporters.use!(
|
55
|
-
[Minitest::Reporters::DefaultReporter.new(color: true),
|
56
|
-
Minitest::Reporters::FailedTestsReporter.new(verbose: true, include_line_numbers: true, output_path: "tmp")
|
57
|
-
],
|
58
|
-
ENV,
|
59
|
-
Minitest.backtrace_filter
|
60
|
-
)
|
61
|
-
|
62
|
-
```
|
63
|
-
|
64
|
-
|
65
|
-
|
66
43
|
### Options
|
67
44
|
- include_line_numbers: Include line numbers in outputs. Defaults to true
|
68
45
|
- verbose: Output to stdout. Defaults to true
|
69
46
|
- file_output: Output to file. Defaults to true
|
70
47
|
- output_path: Path to place output files in. Defaults to '.'
|
48
|
+
- Note: If you use the output_path option, you need to have `ENV["MINITEST_FAILED_TESTS_REPORT_DIR"]` set to use the executable
|
71
49
|
|
72
50
|
## Other
|
73
51
|
### Why line numbers instead of test names? What if the lines change as I am fixing things?
|
@@ -91,10 +69,4 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/houen/
|
|
91
69
|
|
92
70
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
93
71
|
|
94
|
-
## TODO
|
95
|
-
- Better workflow for rerunning tests
|
96
|
-
- Executable for rerun? (https://stackoverflow.com/a/65707495)
|
97
|
-
- Rerun with same seed
|
98
|
-
- Minitest-reporters or minitest plugin?
|
99
|
-
|
100
72
|
https://stackoverflow.com/questions/19910533/minitest-rerun-only-failed-tests
|
@@ -0,0 +1,30 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# See also:
|
4
|
+
# https://guides.rubygems.org/make-your-own-gem/#adding-an-executable
|
5
|
+
|
6
|
+
filename = ".minitest_failed_tests.txt"
|
7
|
+
dirpath = ENV["MINITEST_FAILED_TESTS_REPORT_DIR"] || "./"
|
8
|
+
filepath = File.join(dirpath, filename)
|
9
|
+
|
10
|
+
failed_tests = []
|
11
|
+
|
12
|
+
if !File.exist?(filename)
|
13
|
+
puts "No #{filename} found"
|
14
|
+
elsif File.empty?(filename)
|
15
|
+
puts "No failed tests in #{filename}"
|
16
|
+
else
|
17
|
+
failed_tests += File.readlines(filepath).map{ _1.strip }
|
18
|
+
rails_installed = Gem.loaded_specs.has_key?("rails")
|
19
|
+
if rails_installed
|
20
|
+
cmd = "bundle exec rails test #{failed_tests.join(" ")}"
|
21
|
+
else
|
22
|
+
cmd = "bundle exec ruby #{failed_tests.join(" ")}"
|
23
|
+
end
|
24
|
+
|
25
|
+
IO.popen(cmd) do |io|
|
26
|
+
io.each do |line|
|
27
|
+
puts line
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -20,11 +20,11 @@ Gem::Specification.new do |spec|
|
|
20
20
|
# Specify which files should be added to the gem when it is released.
|
21
21
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
22
22
|
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
23
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
|
23
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features|script|assets)/}) }
|
24
24
|
end
|
25
|
-
spec.bindir = "
|
26
|
-
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
25
|
+
spec.bindir = "bin"
|
27
26
|
spec.require_paths = [ "lib" ]
|
27
|
+
spec.executables << "rerun_failed_tests"
|
28
28
|
|
29
29
|
# Uncomment to register a new dependency of your gem
|
30
30
|
spec.add_runtime_dependency "minitest", "~> 5.0", ">= 5.0.0"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitest-rerun-failed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Søren Houen
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-05-
|
11
|
+
date: 2024-05-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -53,7 +53,8 @@ dependencies:
|
|
53
53
|
description:
|
54
54
|
email:
|
55
55
|
- s@houen.net
|
56
|
-
executables:
|
56
|
+
executables:
|
57
|
+
- rerun_failed_tests
|
57
58
|
extensions: []
|
58
59
|
extra_rdoc_files: []
|
59
60
|
files:
|
@@ -67,8 +68,8 @@ files:
|
|
67
68
|
- LICENSE.txt
|
68
69
|
- README.md
|
69
70
|
- Rakefile
|
70
|
-
- assets/screenshot.png
|
71
71
|
- bin/console
|
72
|
+
- bin/rerun_failed_tests
|
72
73
|
- bin/rubocop
|
73
74
|
- bin/setup
|
74
75
|
- lib/minitest_rerun_failed.rb
|
data/assets/screenshot.png
DELETED
Binary file
|