minitest-rerun-failed 0.2.2 → 0.2.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3adfc832ada93bb9bca1e3ed6dd360caf064469bdef4edd9e00e4946d011848b
4
- data.tar.gz: b57acf4d4c31754c6eb13f9dba689474099bd65aac8d6fe113bdab7adf5e3cb2
3
+ metadata.gz: a5fa0915e0ca55a16334ba0b89ad69d41a70af2ce827bc2a0fa31238648c74e6
4
+ data.tar.gz: 24ca351e6ccb122b59393f67eaa17ada1fe2b1bf907153566e4182ebc0a43f8c
5
5
  SHA512:
6
- metadata.gz: 7a54c9bcb566cf506b82c1b2df723f9d195c0a2bfab99ea62cb72d3d17b63707af2b73e5d7f438d901b7b5e7efbd6bdf579469133386e902bfd616eaa220cbd5
7
- data.tar.gz: 61be4322288e6d8473495ba4378a694e3e2d556b5691910b3db15f944e89a1844baedfdf4553c7f31ff6bfc888cd3e8dd76ed82d3203b71c23dbdadfba5bf15d
6
+ metadata.gz: f93548ba827aed8b2c0f7a4da516bdc9587e158c26d44f5e3fdb5566d1ddf88ddb25b0a5bb141b89f0d7eaf6baedaa4fbcbc7e9245845368d5a46a524322d9cf
7
+ data.tar.gz: ab2c9303f580f8936177c0aecb8bc6440d7e64cdac18a63a13e2c5701c4b679c5afea3495389b45cc90edd1429fc7b2b5cb9f32325923ffd377fd415dd80f831
data/.gitignore CHANGED
@@ -9,3 +9,5 @@
9
9
 
10
10
  /test_output/
11
11
  .minitest_failed_tests.txt
12
+
13
+ *.gem
data/CHANGELOG.md CHANGED
@@ -1,4 +1,7 @@
1
- ## [0.2.2] - 2024-04-20
1
+ ## [0.2.3] - 2024-05-26
2
+ - Added: Rerun tests executable
3
+
4
+ ## [0.2.2] - 2024-05-25
2
5
  - Changed: Also strip file paths when writing to .minitest_failed_tests.txt
3
6
 
4
7
  ## [0.2.1] - 2023-03-31
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- minitest-rerun-failed (0.2.2)
4
+ minitest-rerun-failed (0.2.3)
5
5
  minitest (~> 5.0, >= 5.0.0)
6
6
  minitest-reporters (~> 1.4, >= 1.4.0)
7
7
 
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
- - [TODO] Executable for running only failed tests
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
- Add this line to your application's Gemfile:
23
-
24
- ```ruby
25
- gem 'minitest-rerun-failed'
22
+ ```
23
+ bundle add "minitest-rerun-failed" --group test
26
24
  ```
27
25
 
28
- And then execute:
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
- $ gem install minitest-rerun-failed
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(verbose: true, include_line_numbers: true)
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MinitestRerunFailed
4
- VERSION = "0.2.2"
4
+ VERSION = "0.2.3"
5
5
  end
@@ -2,7 +2,6 @@
2
2
 
3
3
  require "minitest/reporters"
4
4
 
5
- require_relative "minitest_rerun_failed/version"
6
5
  require_relative "minitest_rerun_failed/failed_tests_reporter"
7
6
 
8
7
  module MinitestRerunFailed
@@ -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 = "exe"
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.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Søren Houen
8
8
  autorequire:
9
- bindir: exe
9
+ bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-25 00:00:00.000000000 Z
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,15 +68,14 @@ 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
75
76
  - lib/minitest_rerun_failed/failed_tests_reporter.rb
76
77
  - lib/minitest_rerun_failed/version.rb
77
78
  - minitest_rerun_failed.gemspec
78
- - script/release_gem.sh
79
79
  homepage: https://www.github.com/houen/minitest-rerun-failed
80
80
  licenses:
81
81
  - MIT
Binary file
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- gem build minitest_rerun_failed.gemspec
4
-