minitest-rerun-failed 0.2.0 → 0.2.2.pre

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d0adee6548c17dd8b6fb436dda43949d8cebac77cc19b75ae40ab00f7f58b5c7
4
- data.tar.gz: ee75435eeecbcdddb007aaa8a4d40f32c863ed71472c4d6cc472741523cd3ac6
3
+ metadata.gz: 47654dd26055d685f4c7be65ae1f8063644df6d2847835ba21e7109e84dcb2b2
4
+ data.tar.gz: 56dbff659e39b53fc95bd8191e635a69ed0ac75986f4829f580b43226ff562cb
5
5
  SHA512:
6
- metadata.gz: 60b70ba99a8b265e329d48e83b21e1198ca8873ebcafe5c6d121f87aceaed48c4d328e4acc3a371bf1fc0014d194d04485fe926c1fbbbaec20109653b2b0231d
7
- data.tar.gz: ad662447717f143476212c7fc411e173bf5ce00cc20dcb77ac8dc4ade003416f15789092a73fe81e043b462d5cd07b8b5014f08dd0c725a9e229a672b4a74c36
6
+ metadata.gz: f3046102940f57c7a458f05fd950220a5b1377c6e2b280f5eddd21e1f1eb0f03237fd9df2207dd387c930fcc59b7f0624d652e835b45c65176946d281540fe6f
7
+ data.tar.gz: 181acbbbdcef96aa96f7dff7b00ed1d0ffcc21fff3820fb3b0a99f42f2087bc37b0aecadb5afdbc618dbbcf04e096c50cc01a77cfb6466f28a5f947321f196ac
@@ -26,15 +26,3 @@ jobs:
26
26
  bundler-cache: true
27
27
  - name: Run rake test
28
28
  run: bundle exec rake test
29
-
30
- rake_test_ruby_2_6:
31
- runs-on: ubuntu-latest
32
- steps:
33
- - uses: actions/checkout@v2
34
- - name: Set up Ruby
35
- uses: ruby/setup-ruby@v1
36
- with:
37
- ruby-version: 2.6.8
38
- bundler-cache: true
39
- - name: Run rake test
40
- run: bundle exec rake test
data/.rubocop.yml CHANGED
@@ -1,24 +1,5 @@
1
- AllCops:
2
- TargetRubyVersion: 2.6
3
- NewCops: enable
1
+ # Omakase Ruby styling for Rails
2
+ inherit_gem:
3
+ rubocop-rails-omakase: rubocop.yml
4
4
 
5
- Style/StringLiterals:
6
- Enabled: true
7
- EnforcedStyle: double_quotes
8
-
9
- Style/StringLiteralsInInterpolation:
10
- Enabled: true
11
- EnforcedStyle: double_quotes
12
-
13
- Layout/LineLength:
14
- Enabled: true
15
- Max: 200
16
-
17
- Metrics/MethodLength:
18
- Enabled: false
19
-
20
- Metrics/AbcSize:
21
- Max: 19
22
-
23
- Style/ConditionalAssignment:
24
- Enabled: false
5
+ # Your own specialized rules go here
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.0.2
1
+ 3.3.0
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [0.2.2] - 2024-04-20
2
+ - Changed: Also strip file paths when writing to .minitest_failed_tests.txt
3
+
4
+ ## [0.2.1] - 2023-03-31
5
+ - Fixed: Strip leading whitespace from failure locations in output
6
+ - Set dependency versions with >= so they do not enforce old versions
7
+
1
8
  ## [0.2.0] - 2021-09-12
2
9
  - Add support for Ruby 2.6
3
10
 
@@ -6,5 +13,3 @@
6
13
  - Outputs to console
7
14
  - Outputs to file
8
15
  - Rerun must be done semi-manually via something like `bundle exec rails test $(cat .minitest_failed_tests.txt)`
9
-
10
-
data/Gemfile CHANGED
@@ -8,6 +8,6 @@ gemspec
8
8
  gem "minitest"
9
9
  gem "minitest-reporters"
10
10
  gem "rake"
11
- gem "rubocop"
12
11
  gem "rubocop-minitest"
13
12
  gem "rubocop-rake"
13
+ gem "rubocop-rails-omakase", require: false, group: :development
data/Gemfile.lock CHANGED
@@ -1,25 +1,44 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- minitest-rerun-failed (0.2.0)
5
- minitest (~> 5.14.4)
6
- minitest-reporters (~> 1.4.3)
4
+ minitest-rerun-failed (0.2.2.pre)
5
+ minitest (~> 5.0, >= 5.0.0)
6
+ minitest-reporters (~> 1.4, >= 1.4.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
+ activesupport (7.1.3.2)
12
+ base64
13
+ bigdecimal
14
+ concurrent-ruby (~> 1.0, >= 1.0.2)
15
+ connection_pool (>= 2.2.5)
16
+ drb
17
+ i18n (>= 1.6, < 2)
18
+ minitest (>= 5.1)
19
+ mutex_m
20
+ tzinfo (~> 2.0)
11
21
  ansi (1.5.0)
12
22
  ast (2.4.2)
23
+ base64 (0.2.0)
24
+ bigdecimal (3.1.7)
13
25
  builder (3.2.4)
26
+ concurrent-ruby (1.2.3)
27
+ connection_pool (2.4.1)
28
+ drb (2.2.1)
29
+ i18n (1.14.4)
30
+ concurrent-ruby (~> 1.0)
14
31
  minitest (5.14.4)
15
32
  minitest-reporters (1.4.3)
16
33
  ansi
17
34
  builder
18
35
  minitest (>= 5.0)
19
36
  ruby-progressbar
37
+ mutex_m (0.2.0)
20
38
  parallel (1.20.1)
21
39
  parser (3.0.2.0)
22
40
  ast (~> 2.4.1)
41
+ rack (3.0.10)
23
42
  rainbow (3.0.0)
24
43
  rake (13.0.6)
25
44
  regexp_parser (2.1.1)
@@ -37,12 +56,28 @@ GEM
37
56
  parser (>= 3.0.1.1)
38
57
  rubocop-minitest (0.15.0)
39
58
  rubocop (>= 0.90, < 2.0)
59
+ rubocop-performance (1.19.1)
60
+ rubocop (>= 1.7.0, < 2.0)
61
+ rubocop-ast (>= 0.4.0)
62
+ rubocop-rails (2.15.2)
63
+ activesupport (>= 4.2.0)
64
+ rack (>= 1.1)
65
+ rubocop (>= 1.7.0, < 2.0)
66
+ rubocop-rails-omakase (1.0.0)
67
+ rubocop
68
+ rubocop-minitest
69
+ rubocop-performance
70
+ rubocop-rails
40
71
  rubocop-rake (0.6.0)
41
72
  rubocop (~> 1.0)
42
73
  ruby-progressbar (1.11.0)
74
+ tzinfo (2.0.6)
75
+ concurrent-ruby (~> 1.0)
43
76
  unicode-display_width (2.0.0)
44
77
 
45
78
  PLATFORMS
79
+ arm64-darwin-21
80
+ arm64-darwin-22
46
81
  x86_64-darwin-19
47
82
  x86_64-darwin-20
48
83
  x86_64-linux
@@ -52,8 +87,8 @@ DEPENDENCIES
52
87
  minitest-reporters
53
88
  minitest-rerun-failed!
54
89
  rake
55
- rubocop
56
90
  rubocop-minitest
91
+ rubocop-rails-omakase
57
92
  rubocop-rake
58
93
 
59
94
  BUNDLED WITH
data/README.md CHANGED
@@ -1,17 +1,19 @@
1
1
  # minitest-rerun-failed
2
+ [![Gem Version](https://badge.fury.io/rb/minitest-rerun-failed.svg)](https://badge.fury.io/rb/minitest-rerun-failed)
2
3
  ![master branch CI](https://github.com/houen/minitest-rerun-failed/actions/workflows/main.yml/badge.svg?branch=master)
4
+ [![Gem Version](https://badge.fury.io/rb/minitest-rerun-failed.svg)](https://badge.fury.io/rb/minitest-rerun-failed)
3
5
 
4
- Easy rerun of failed tests with minitest.
6
+ Easy rerun of failed tests with minitest. Prints a list of failed tests and seed at the end of the test run to console and file. Allows for re-running the failed tests via `cat`'ing the outputted file.
5
7
 
6
8
  ![Example screenshot](assets/screenshot.png)
7
9
 
8
- ## Goals
10
+ ## Features
9
11
  - Outputs all failed tests in short summary at end of test run.
10
12
  - To console and / or to file
11
13
  - Optionally includes line numbers
12
14
  - Lists seed of run for rerun.
13
15
  - [TODO] Executable for running only failed tests
14
- - Until then, use something like
16
+ - Until done, use something like
15
17
  - `ruby $(cat .minitest_failed_tests.txt)`
16
18
  - `bundle exec rails test $(cat .minitest_failed_tests.txt)`
17
19
 
@@ -20,7 +22,7 @@ Easy rerun of failed tests with minitest.
20
22
  Add this line to your application's Gemfile:
21
23
 
22
24
  ```ruby
23
- gem 'minitest_rerun_failed'
25
+ gem 'minitest-rerun-failed'
24
26
  ```
25
27
 
26
28
  And then execute:
@@ -29,19 +31,38 @@ And then execute:
29
31
 
30
32
  Or install it yourself as:
31
33
 
32
- $ gem install minitest_rerun_failed
34
+ $ gem install minitest-rerun-failed
33
35
 
34
36
  ## Usage
35
37
 
36
38
  Use it like any Minitest::Reporters like such:
37
39
 
38
- ```
40
+ ```ruby
39
41
  Minitest::Reporters.use! [
40
42
  Minitest::Reporters::ProgressReporter.new, # This is just my preferred reporter. Use the one(s) you like.
41
43
  Minitest::Reporters::FailedTestsReporter.new(verbose: true, include_line_numbers: true)
42
44
  ]
43
45
  ```
44
46
 
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
+
45
66
  ### Options
46
67
  - include_line_numbers: Include line numbers in outputs. Defaults to true
47
68
  - verbose: Output to stdout. Defaults to true
@@ -71,8 +92,9 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/houen/
71
92
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
72
93
 
73
94
  ## TODO
74
- - Executable for rerun? (https://stackoverflow.com/a/65707495)
75
- - Rerun with same seed
95
+ - Better workflow for rerunning tests
96
+ - Executable for rerun? (https://stackoverflow.com/a/65707495)
97
+ - Rerun with same seed
76
98
  - Minitest-reporters or minitest plugin?
77
99
 
78
100
  https://stackoverflow.com/questions/19910533/minitest-rerun-only-failed-tests
data/Rakefile CHANGED
@@ -19,4 +19,4 @@ require "rubocop/rake_task"
19
19
 
20
20
  RuboCop::RakeTask.new
21
21
 
22
- task default: %i[test rubocop]
22
+ task default: %i[test]
data/bin/rubocop ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rubocop' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("rubocop", "rubocop")
@@ -68,13 +68,15 @@ module Minitest
68
68
  tmp_haystack << test.failure.location
69
69
  tmp_haystack << test.to_s
70
70
  # Add filtered backtrace unless it is an unexpected error, which do not have a useful trace
71
- tmp_haystack << filter_backtrace(test.failure.backtrace).join unless test.failure.is_a?(MiniTest::UnexpectedError)
71
+ tmp_haystack << filter_backtrace(test.failure.backtrace).join unless test.failure.is_a?(Minitest::UnexpectedError)
72
72
 
73
73
  # Get failure location as best we can from haystack
74
74
  if @include_line_numbers
75
- failure_file_location = tmp_haystack.join[/(.+_test\.rb:[0-9]+)/, 1]
75
+ regex_keeping_line_numbers = /(.+_test\.rb:[0-9]+)/
76
+ failure_file_location = tmp_haystack.join[regex_keeping_line_numbers, 1]
76
77
  else
77
- failure_file_location = tmp_haystack.join[/(.+_test\.rb):[0-9]+/, 1]
78
+ regex_removing_line_numbers = /(.+_test\.rb):[0-9]+/
79
+ failure_file_location = tmp_haystack.join[regex_removing_line_numbers, 1]
78
80
  end
79
81
 
80
82
  return unless failure_file_location
@@ -83,7 +85,7 @@ module Minitest
83
85
  failure_file_location.gsub!(curdir, "")
84
86
  failure_file_location.gsub!(%r{^/}, "")
85
87
 
86
- failure_file_location
88
+ failure_file_location.to_s.strip
87
89
  end
88
90
 
89
91
  def output_results(failure_paths, file_output)
@@ -92,9 +94,11 @@ module Minitest
92
94
  _puts("")
93
95
  headline = @include_line_numbers ? "Failed tests: #{failure_paths.count} (seed #{@options[:seed]}):" : "Failed test files: #{failure_paths.count} (seed #{@options[:seed]}):"
94
96
  _puts(headline)
97
+
95
98
  failure_paths.uniq.each do |file_path|
96
- file_output << file_path.to_s
97
- _puts red(file_path.strip)
99
+ stripped_path = file_path.strip
100
+ file_output << stripped_path
101
+ _puts color_red(stripped_path)
98
102
  end
99
103
  end
100
104
 
@@ -119,15 +123,15 @@ module Minitest
119
123
  end
120
124
  end
121
125
 
122
- def green(string)
126
+ def color_green(string)
123
127
  color? ? ANSI::Code.green(string) : string
124
128
  end
125
129
 
126
- def yellow(string)
130
+ def color_yellow(string)
127
131
  color? ? ANSI::Code.yellow(string) : string
128
132
  end
129
133
 
130
- def red(string)
134
+ def color_red(string)
131
135
  color? ? ANSI::Code.red(string) : string
132
136
  end
133
137
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MinitestRerunFailed
4
- VERSION = "0.2.0"
4
+ VERSION = "0.2.2.pre"
5
5
  end
@@ -5,13 +5,13 @@ require_relative "lib/minitest_rerun_failed/version"
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "minitest-rerun-failed"
7
7
  spec.version = MinitestRerunFailed::VERSION
8
- spec.authors = ["Søren Houen"]
9
- spec.email = ["s@houen.net"]
8
+ spec.authors = [ "Søren Houen" ]
9
+ spec.email = [ "s@houen.net" ]
10
10
 
11
11
  spec.summary = "Easily rerun failed tests with Minitest"
12
12
  spec.homepage = "https://www.github.com/houen/minitest-rerun-failed"
13
13
  spec.license = "MIT"
14
- spec.required_ruby_version = ">= 2.6.0"
14
+ spec.required_ruby_version = ">= 2.7.0"
15
15
 
16
16
  spec.metadata["homepage_uri"] = spec.homepage
17
17
  spec.metadata["source_code_uri"] = "https://www.github.com/houen/minitest-rerun-failed"
@@ -24,11 +24,11 @@ Gem::Specification.new do |spec|
24
24
  end
25
25
  spec.bindir = "exe"
26
26
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
27
- spec.require_paths = ["lib"]
27
+ spec.require_paths = [ "lib" ]
28
28
 
29
29
  # Uncomment to register a new dependency of your gem
30
- spec.add_dependency "minitest", "~> 5.14.4"
31
- spec.add_dependency "minitest-reporters", "~> 1.4.3"
30
+ spec.add_runtime_dependency "minitest", "~> 5.0", ">= 5.0.0"
31
+ spec.add_runtime_dependency "minitest-reporters", "~> 1.4", ">= 1.4.0"
32
32
 
33
33
  # For more information and examples about making a new gem, checkout our
34
34
  # guide at: https://bundler.io/guides/creating_gem.html
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.0
4
+ version: 0.2.2.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Søren Houen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-09-13 00:00:00.000000000 Z
11
+ date: 2024-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -16,28 +16,40 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 5.14.4
19
+ version: '5.0'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 5.0.0
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
27
  - - "~>"
25
28
  - !ruby/object:Gem::Version
26
- version: 5.14.4
29
+ version: '5.0'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 5.0.0
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: minitest-reporters
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
37
  - - "~>"
32
38
  - !ruby/object:Gem::Version
33
- version: 1.4.3
39
+ version: '1.4'
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 1.4.0
34
43
  type: :runtime
35
44
  prerelease: false
36
45
  version_requirements: !ruby/object:Gem::Requirement
37
46
  requirements:
38
47
  - - "~>"
39
48
  - !ruby/object:Gem::Version
40
- version: 1.4.3
49
+ version: '1.4'
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 1.4.0
41
53
  description:
42
54
  email:
43
55
  - s@houen.net
@@ -57,6 +69,7 @@ files:
57
69
  - Rakefile
58
70
  - assets/screenshot.png
59
71
  - bin/console
72
+ - bin/rubocop
60
73
  - bin/setup
61
74
  - lib/minitest_rerun_failed.rb
62
75
  - lib/minitest_rerun_failed/failed_tests_reporter.rb
@@ -77,14 +90,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
77
90
  requirements:
78
91
  - - ">="
79
92
  - !ruby/object:Gem::Version
80
- version: 2.6.0
93
+ version: 2.7.0
81
94
  required_rubygems_version: !ruby/object:Gem::Requirement
82
95
  requirements:
83
96
  - - ">="
84
97
  - !ruby/object:Gem::Version
85
98
  version: '0'
86
99
  requirements: []
87
- rubygems_version: 3.2.22
100
+ rubygems_version: 3.5.10
88
101
  signing_key:
89
102
  specification_version: 4
90
103
  summary: Easily rerun failed tests with Minitest