nicetest 0.1.2 → 0.1.5
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 +4 -4
- checksums.yaml.gz.sig +1 -2
- data/README.md +39 -9
- data/lib/minitest/nicetest_plugin.rb +6 -2
- data/lib/minitest/reporters_plugin.rb +19 -17
- data/lib/minitest/superdiff_plugin.rb +40 -37
- data/lib/nicetest/cli.rb +37 -10
- data/lib/nicetest/test_finder.rb +2 -1
- data/lib/nicetest/version.rb +1 -1
- data/lib/nicetest.rb +3 -0
- data.tar.gz.sig +0 -0
- metadata +45 -3
- metadata.gz.sig +0 -0
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: bd840baef344a54b96b5b2cb3d6a21c70a3d2b4c497bee0fc6c3f963a839d7b1
         | 
| 4 | 
            +
              data.tar.gz: dc0847ffd7f0c3b17c6e4f284e5cfad2688eed8e9d123f65b2311ae508321ec2
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: e427bd82c9fe9b3b22d42ccf9cbbbbb5c89d63ed883eabb0b401157f39808ac9d13f89825f207158c11b46fb3f330b7462c64b2d29b6b23c8933a2fd3c958db8
         | 
| 7 | 
            +
              data.tar.gz: 2484e985c2547e91a2a4b636711ae4b48d809cf18e7f6503f94de2a30cbd3489b1e2077bc4c71989dfbc9db81043dad2ab2d4d422ae9ca87c81d9e19e1e5390a
         | 
    
        checksums.yaml.gz.sig
    CHANGED
    
    | @@ -1,2 +1 @@ | |
| 1 | 
            -
            � | 
| 2 | 
            -
            ��ԞR¼�a��2�xd���I7�ov.��S���ddMk��e=Ť�R�CD��	V�+�@�.� q�T�ʥ�c��V��u{�f�D4
         | 
| 1 | 
            +
            �Gm/����n�L*�����`
         | 
    
        data/README.md
    CHANGED
    
    | @@ -26,19 +26,35 @@ $ gem install nicetest | |
| 26 26 | 
             
            # Go into a repo
         | 
| 27 27 | 
             
            $ git clone https://github.com/Shopfy/liquid; cd liquid; bundle install
         | 
| 28 28 |  | 
| 29 | 
            -
            # Run  | 
| 30 | 
            -
             | 
| 31 | 
            -
            Started with run options --reporter doc --seed  | 
| 29 | 
            +
            # Run a test
         | 
| 30 | 
            +
            ❯ nicetest --reporter doc test/integration/capture_test.rb:14
         | 
| 31 | 
            +
            Started with run options --reporter doc --name=/CaptureTest#test_capture_with_hyphen_in_variable_name/ --seed 24518
         | 
| 32 32 |  | 
| 33 33 | 
             
            CaptureTest
         | 
| 34 | 
            -
              test_increment_assign_score_by_bytes_not_characters             PASS (0.00s)
         | 
| 35 | 
            -
              test_captures_block_content_in_variable                         PASS (0.00s)
         | 
| 36 | 
            -
              test_capture_to_variable_from_outer_scope_if_existing           PASS (0.00s)
         | 
| 37 | 
            -
              test_assigning_from_capture                                     PASS (0.00s)
         | 
| 38 34 | 
             
              test_capture_with_hyphen_in_variable_name                       PASS (0.00s)
         | 
| 39 35 |  | 
| 40 | 
            -
            Finished in 0. | 
| 41 | 
            -
             | 
| 36 | 
            +
            Finished in 0.00115s
         | 
| 37 | 
            +
            1 tests, 1 assertions, 0 failures, 0 errors, 0 skips
         | 
| 38 | 
            +
             | 
| 39 | 
            +
            # JUnit is easy
         | 
| 40 | 
            +
            ❯ nicetest --reporter junit,progress                          
         | 
| 41 | 
            +
            Emptying /Users/ianks/Code/Shopify/liquid/tmp/nicetest/junit/1721874837
         | 
| 42 | 
            +
            Started with run options --reporter junit,progress --seed 36139
         | 
| 43 | 
            +
             | 
| 44 | 
            +
              799/799: [================================================================================] 100% Time: 00:00:00, Time: 00:00:00
         | 
| 45 | 
            +
            Writing XML reports to /Users/ianks/Code/Shopify/liquid/tmp/nicetest/junit/1721874837
         | 
| 46 | 
            +
             | 
| 47 | 
            +
            Finished in 0.94625s
         | 
| 48 | 
            +
            799 tests, 1924 assertions, 0 failures, 0 errors, 0 skips
         | 
| 49 | 
            +
             | 
| 50 | 
            +
            # Filter by name
         | 
| 51 | 
            +
            ❯ nicetest --name=/assign/ 
         | 
| 52 | 
            +
            Started with run options --name=/assign/ --seed 44734
         | 
| 53 | 
            +
             | 
| 54 | 
            +
              33/33: [====================================================================================] 100% Time: 00:00:00, Time: 00:00:00
         | 
| 55 | 
            +
             | 
| 56 | 
            +
            Finished in 0.03157s
         | 
| 57 | 
            +
            33 tests, 69 assertions, 0 failures, 0 errors, 0 skips
         | 
| 42 58 | 
             
            ```
         | 
| 43 59 |  | 
| 44 60 | 
             
            ### Add to project
         | 
| @@ -86,6 +102,14 @@ task :test do | |
| 86 102 | 
             
            end
         | 
| 87 103 | 
             
            ```
         | 
| 88 104 |  | 
| 105 | 
            +
            ## Recognition
         | 
| 106 | 
            +
             | 
| 107 | 
            +
            - [minitest] for superb testing
         | 
| 108 | 
            +
            - [minitest-reporters] for the excellent reporting
         | 
| 109 | 
            +
            - [super_diff] for the pretty diffs
         | 
| 110 | 
            +
            - [prism] for the blissful parser
         | 
| 111 | 
            +
            - [pastel] for the pretty colors
         | 
| 112 | 
            +
             | 
| 89 113 | 
             
            ## Contributing
         | 
| 90 114 |  | 
| 91 115 | 
             
            Bug reports and pull requests are welcome on GitHub at
         | 
| @@ -95,3 +119,9 @@ https://github.com/ianks/nicetest. | |
| 95 119 |  | 
| 96 120 | 
             
            The gem is available as open source under the terms of the [MIT
         | 
| 97 121 | 
             
            License](https://opensource.org/licenses/MIT).
         | 
| 122 | 
            +
             | 
| 123 | 
            +
            [minitest]: https://github.com/minitest/minitest
         | 
| 124 | 
            +
            [minitest-reporters]: https://github.com/minitest-reporters/minitest-reporters
         | 
| 125 | 
            +
            [super_diff]: https://github.com/mcmire/super_diff
         | 
| 126 | 
            +
            [prism]: https://github.com/ruby/prism
         | 
| 127 | 
            +
            [pastel]: https://github.com/piotrmurach/pastel
         | 
| @@ -6,14 +6,18 @@ require "nicetest" | |
| 6 6 | 
             
            module Minitest
         | 
| 7 7 | 
             
              class << self
         | 
| 8 8 | 
             
                def plugin_nicetest_options(opts, options)
         | 
| 9 | 
            -
                  opts.banner = Nicetest::Cli::BANNER
         | 
| 10 | 
            -
                  ValidateMinitestFocus.apply!
         | 
| 9 | 
            +
                  opts.banner = ::Nicetest::Cli::BANNER
         | 
| 10 | 
            +
                  Nicetest::NicetestPlugin::ValidateMinitestFocus.apply!
         | 
| 11 11 | 
             
                end
         | 
| 12 12 |  | 
| 13 13 | 
             
                def plugin_nicetest_init(_options)
         | 
| 14 14 | 
             
                  Minitest.backtrace_filter = Nicetest::BacktraceFilter.new
         | 
| 15 15 | 
             
                end
         | 
| 16 | 
            +
              end
         | 
| 17 | 
            +
            end
         | 
| 16 18 |  | 
| 19 | 
            +
            module Nicetest
         | 
| 20 | 
            +
              module NicetestPlugin
         | 
| 17 21 | 
             
                module ValidateMinitestFocus
         | 
| 18 22 | 
             
                  class << self
         | 
| 19 23 | 
             
                    def apply!
         | 
| @@ -1,25 +1,11 @@ | |
| 1 1 | 
             
            # frozen_string_literal: true
         | 
| 2 2 |  | 
| 3 3 | 
             
            module Minitest
         | 
| 4 | 
            -
              module ReportersPlugin
         | 
| 5 | 
            -
                MAPPING ||= {
         | 
| 6 | 
            -
                  "none" => ->(_options) { nil },
         | 
| 7 | 
            -
                  "default" => ->(options) { Minitest::Reporters::DefaultReporter.new(io: options[:io]) },
         | 
| 8 | 
            -
                  "spec" => ->(options) { Minitest::Reporters::SpecReporter.new(io: options[:io]) },
         | 
| 9 | 
            -
                  "doc" => ->(options) { MAPPING["spec"].call(options) },
         | 
| 10 | 
            -
                  "junit" => ->(options) {
         | 
| 11 | 
            -
                    ENV["MINITEST_REPORTERS_REPORTS_DIR"] ||= "tmp/nicetest/junit/#{Time.now.to_i}"
         | 
| 12 | 
            -
                    Minitest::Reporters::JUnitReporter.new(io: options[:io])
         | 
| 13 | 
            -
                  },
         | 
| 14 | 
            -
                  "progress" => ->(options) { Minitest::Reporters::ProgressReporter.new(io: options[:io]) },
         | 
| 15 | 
            -
                }
         | 
| 16 | 
            -
              end
         | 
| 17 | 
            -
             | 
| 18 4 | 
             
              class << self
         | 
| 19 5 | 
             
                def plugin_reporters_options(opts, options)
         | 
| 20 6 | 
             
                  options[:reporters] = ["progress"]
         | 
| 21 7 |  | 
| 22 | 
            -
                  vals =  | 
| 8 | 
            +
                  vals = Nicetest::ReportersPlugin::MAPPING.keys.join(",")
         | 
| 23 9 | 
             
                  description = <<~DESC.strip
         | 
| 24 10 | 
             
                    The reporters to use for test output as comma-seperated list.
         | 
| 25 11 | 
             
                  DESC
         | 
| @@ -27,7 +13,7 @@ module Minitest | |
| 27 13 | 
             
                  opts.on("-r", "--reporter #{vals}", Array, description) do |reporters|
         | 
| 28 14 | 
             
                    reporters = options[:reporters] + reporters if reporters == ["junit"]
         | 
| 29 15 |  | 
| 30 | 
            -
                    is_subset = (reporters -  | 
| 16 | 
            +
                    is_subset = (reporters - Nicetest::ReportersPlugin::MAPPING.keys).empty?
         | 
| 31 17 | 
             
                    raise OptionParser::InvalidArgument, "Invalid reporter: #{reporters.join(", ")}" unless is_subset
         | 
| 32 18 |  | 
| 33 19 | 
             
                    options[:reporters] = reporters
         | 
| @@ -40,10 +26,26 @@ module Minitest | |
| 40 26 | 
             
                  require "minitest/reporters"
         | 
| 41 27 |  | 
| 42 28 | 
             
                  reporters = options[:reporters].map do |reporter|
         | 
| 43 | 
            -
                    ReportersPlugin::MAPPING.fetch(reporter).call(options)
         | 
| 29 | 
            +
                    Nicetest::ReportersPlugin::MAPPING.fetch(reporter).call(options)
         | 
| 44 30 | 
             
                  end.compact
         | 
| 45 31 |  | 
| 46 32 | 
             
                  Minitest::Reporters.use!(reporters, ENV, Minitest.backtrace_filter) unless reporters.empty?
         | 
| 47 33 | 
             
                end
         | 
| 48 34 | 
             
              end
         | 
| 49 35 | 
             
            end
         | 
| 36 | 
            +
             | 
| 37 | 
            +
            module Nicetest
         | 
| 38 | 
            +
              module ReportersPlugin
         | 
| 39 | 
            +
                MAPPING = {
         | 
| 40 | 
            +
                  "none" => ->(_options) { nil },
         | 
| 41 | 
            +
                  "default" => ->(options) { Minitest::Reporters::DefaultReporter.new(io: options[:io]) },
         | 
| 42 | 
            +
                  "spec" => ->(options) { Minitest::Reporters::SpecReporter.new(io: options[:io]) },
         | 
| 43 | 
            +
                  "doc" => ->(options) { MAPPING["spec"].call(options) },
         | 
| 44 | 
            +
                  "junit" => ->(options) {
         | 
| 45 | 
            +
                    ENV["MINITEST_REPORTERS_REPORTS_DIR"] ||= "tmp/nicetest/junit/#{Time.now.to_i}"
         | 
| 46 | 
            +
                    Minitest::Reporters::JUnitReporter.new(io: options[:io])
         | 
| 47 | 
            +
                  },
         | 
| 48 | 
            +
                  "progress" => ->(options) { Minitest::Reporters::ProgressReporter.new(io: options[:io]) },
         | 
| 49 | 
            +
                }
         | 
| 50 | 
            +
              end
         | 
| 51 | 
            +
            end
         | 
| @@ -12,13 +12,16 @@ module Minitest | |
| 12 12 | 
             
                  return if options[:no_superdiff]
         | 
| 13 13 |  | 
| 14 14 | 
             
                  require "super_diff"
         | 
| 15 | 
            -
                  Minitest::Assertions.prepend(SuperdiffPlugin)
         | 
| 15 | 
            +
                  Minitest::Assertions.prepend(Nicetest::SuperdiffPlugin)
         | 
| 16 16 | 
             
                end
         | 
| 17 17 | 
             
              end
         | 
| 18 | 
            +
            end
         | 
| 18 19 |  | 
| 20 | 
            +
            module Nicetest
         | 
| 19 21 | 
             
              module SuperdiffPlugin
         | 
| 20 22 | 
             
                module Helpers
         | 
| 21 23 | 
             
                  extend self
         | 
| 24 | 
            +
             | 
| 22 25 | 
             
                  def inspect_styled(obj, style, prefix: nil)
         | 
| 23 26 | 
             
                    obj = SuperDiff.inspect_object(obj, as_lines: false)
         | 
| 24 27 | 
             
                    SuperDiff::Core::Helpers.style(style, "#{prefix}#{obj}")
         | 
| @@ -42,54 +45,54 @@ module Minitest | |
| 42 45 | 
             
                  exception.set_backtrace(e.backtrace)
         | 
| 43 46 | 
             
                  raise exception
         | 
| 44 47 | 
             
                end
         | 
| 45 | 
            -
              end
         | 
| 46 48 |  | 
| 47 | 
            -
             | 
| 48 | 
            -
             | 
| 49 | 
            +
                class AssertIncludesMessage
         | 
| 50 | 
            +
                  include SuperdiffPlugin::Helpers
         | 
| 49 51 |  | 
| 50 | 
            -
             | 
| 51 | 
            -
             | 
| 52 | 
            -
             | 
| 53 | 
            -
             | 
| 52 | 
            +
                  def initialize(collection:, item:)
         | 
| 53 | 
            +
                    @collection = collection
         | 
| 54 | 
            +
                    @item = item
         | 
| 55 | 
            +
                  end
         | 
| 54 56 |  | 
| 55 | 
            -
             | 
| 56 | 
            -
             | 
| 57 | 
            +
                  def to_s
         | 
| 58 | 
            +
                    return @to_s if defined?(@to_s)
         | 
| 57 59 |  | 
| 58 | 
            -
             | 
| 59 | 
            -
             | 
| 60 | 
            -
             | 
| 60 | 
            +
                    content = if (diff = optional_diff)
         | 
| 61 | 
            +
                      collection = inspect_styled(@collection, :expected)
         | 
| 62 | 
            +
                      item = inspect_styled(@item, :actual)
         | 
| 61 63 |  | 
| 62 | 
            -
             | 
| 63 | 
            -
             | 
| 64 | 
            +
                      <<~OUTPUT.strip
         | 
| 65 | 
            +
                        Expected #{collection} to include #{item}, but it did not.
         | 
| 64 66 |  | 
| 65 | 
            -
             | 
| 66 | 
            -
             | 
| 67 | 
            -
             | 
| 68 | 
            -
             | 
| 69 | 
            -
             | 
| 67 | 
            +
                        #{diff}
         | 
| 68 | 
            +
                      OUTPUT
         | 
| 69 | 
            +
                    else
         | 
| 70 | 
            +
                      expected = inspect_styled(@collection, :expected, prefix: "  Collection: ")
         | 
| 71 | 
            +
                      actual = inspect_styled(@item, :actual, prefix: "Missing item: ")
         | 
| 70 72 |  | 
| 71 | 
            -
             | 
| 72 | 
            -
             | 
| 73 | 
            +
                      <<~OUTPUT.strip
         | 
| 74 | 
            +
                        Expected collection to include item but it did not.
         | 
| 73 75 |  | 
| 74 | 
            -
             | 
| 75 | 
            -
             | 
| 76 | 
            -
             | 
| 77 | 
            -
             | 
| 76 | 
            +
                        #{expected}
         | 
| 77 | 
            +
                        #{actual}
         | 
| 78 | 
            +
                      OUTPUT
         | 
| 79 | 
            +
                    end
         | 
| 78 80 |  | 
| 79 | 
            -
             | 
| 80 | 
            -
             | 
| 81 | 
            +
                    @to_s ||= content
         | 
| 82 | 
            +
                  end
         | 
| 81 83 |  | 
| 82 | 
            -
             | 
| 83 | 
            -
             | 
| 84 | 
            -
             | 
| 85 | 
            -
             | 
| 86 | 
            -
             | 
| 84 | 
            +
                  def optional_diff
         | 
| 85 | 
            +
                    case @collection
         | 
| 86 | 
            +
                    when Array, Set
         | 
| 87 | 
            +
                      collection_with_item = @collection + [@item].flatten(1)
         | 
| 88 | 
            +
                      basic_diff(@collection, collection_with_item)
         | 
| 89 | 
            +
                    end
         | 
| 87 90 | 
             
                  end
         | 
| 88 | 
            -
                end
         | 
| 89 91 |  | 
| 90 | 
            -
             | 
| 91 | 
            -
             | 
| 92 | 
            -
             | 
| 92 | 
            +
                  def basic_diff(expected, actual)
         | 
| 93 | 
            +
                    content = SuperDiff.diff(expected, actual)
         | 
| 94 | 
            +
                    "\nDiff:\n\n#{content}"
         | 
| 95 | 
            +
                  end
         | 
| 93 96 | 
             
                end
         | 
| 94 97 | 
             
              end
         | 
| 95 98 | 
             
            end
         | 
    
        data/lib/nicetest/cli.rb
    CHANGED
    
    | @@ -9,8 +9,10 @@ require "set" | |
| 9 9 | 
             
            module Nicetest
         | 
| 10 10 | 
             
              class Cli
         | 
| 11 11 | 
             
                def initialize(argv)
         | 
| 12 | 
            +
                  @original_argv = argv.dup
         | 
| 12 13 | 
             
                  @argv = argv
         | 
| 13 14 | 
             
                  @logger = Logger.new($stderr)
         | 
| 15 | 
            +
                  adjust_load_path!
         | 
| 14 16 | 
             
                end
         | 
| 15 17 |  | 
| 16 18 | 
             
                def run
         | 
| @@ -26,7 +28,6 @@ module Nicetest | |
| 26 28 |  | 
| 27 29 | 
             
                def run_tests(cli_options = Opts.parse!(@argv))
         | 
| 28 30 | 
             
                  disable_autorun!
         | 
| 29 | 
            -
                  adjust_load_path!
         | 
| 30 31 |  | 
| 31 32 | 
             
                  args = @argv.dup
         | 
| 32 33 | 
             
                  argv_test_files = select_file_args(args)
         | 
| @@ -42,6 +43,10 @@ module Nicetest | |
| 42 43 | 
             
                    filters << name
         | 
| 43 44 | 
             
                  end
         | 
| 44 45 |  | 
| 46 | 
            +
                  # Gross hack to allow for plugins to be loaded before we require the test files
         | 
| 47 | 
            +
                  Minitest.load_plugins unless args.delete("--no-plugins") || ENV["MT_NO_PLUGINS"]
         | 
| 48 | 
            +
                  processed_args = Minitest.process_args(args)
         | 
| 49 | 
            +
             | 
| 45 50 | 
             
                  required_files = argv_test_files.map do |pattern|
         | 
| 46 51 | 
             
                    file_or_dir, filter = finder.filter_for(pattern)
         | 
| 47 52 | 
             
                    filters << filter if filter && !cli_options.name
         | 
| @@ -49,13 +54,30 @@ module Nicetest | |
| 49 54 | 
             
                  end
         | 
| 50 55 |  | 
| 51 56 | 
             
                  @logger.fatal!("no test files found") if required_files.compact.empty?
         | 
| 52 | 
            -
             | 
| 57 | 
            +
             | 
| 58 | 
            +
                  if filters.any?
         | 
| 59 | 
            +
                    processed_args[:filter] = Regexp.union(*filters.map do |source|
         | 
| 60 | 
            +
                      Regexp.new(source)
         | 
| 61 | 
            +
                    end)
         | 
| 62 | 
            +
             | 
| 63 | 
            +
                    processed_args[:args] = "#{processed_args[:args]} --name=/#{processed_args[:filter].source}/"
         | 
| 64 | 
            +
                  end
         | 
| 65 | 
            +
             | 
| 66 | 
            +
                  patch_minitest_process_args!(processed_args)
         | 
| 53 67 |  | 
| 54 68 | 
             
                  Minitest.run(args)
         | 
| 55 69 | 
             
                end
         | 
| 56 70 |  | 
| 57 71 | 
             
                private
         | 
| 58 72 |  | 
| 73 | 
            +
                def patch_minitest_process_args!(preprocessed)
         | 
| 74 | 
            +
                  original_process_args = Minitest.method(:process_args)
         | 
| 75 | 
            +
                  Minitest.define_singleton_method(:process_args) do |_input_args|
         | 
| 76 | 
            +
                    Minitest.define_singleton_method(:process_args, original_process_args)
         | 
| 77 | 
            +
                    preprocessed
         | 
| 78 | 
            +
                  end
         | 
| 79 | 
            +
                end
         | 
| 80 | 
            +
             | 
| 59 81 | 
             
                def fetch_dep_loadpaths(gemspec, seen = {})
         | 
| 60 82 | 
             
                  return [] if seen[gemspec.name]
         | 
| 61 83 |  | 
| @@ -87,7 +109,8 @@ module Nicetest | |
| 87 109 |  | 
| 88 110 | 
             
                  loadpaths = fetch_dep_loadpaths(Gem.loaded_specs["nicetest"]).map { |path| "-I#{path}" }
         | 
| 89 111 | 
             
                  requires = ["-rnicetest"]
         | 
| 90 | 
            -
                   | 
| 112 | 
            +
                  includes = ["-I#{dir}/test"]
         | 
| 113 | 
            +
                  args_with_removed_leading_path = @original_argv.map do |arg|
         | 
| 91 114 | 
             
                    arg = arg.dup
         | 
| 92 115 | 
             
                    arg.delete_prefix!(dir)
         | 
| 93 116 | 
             
                    arg.delete_prefix!(File.expand_path(dir))
         | 
| @@ -102,6 +125,7 @@ module Nicetest | |
| 102 125 | 
             
                      RbConfig.ruby,
         | 
| 103 126 | 
             
                      *loadpaths,
         | 
| 104 127 | 
             
                      *requires,
         | 
| 128 | 
            +
                      *includes,
         | 
| 105 129 | 
             
                      "-e",
         | 
| 106 130 | 
             
                      "exit(Nicetest::Cli.new(ARGV).run_tests)",
         | 
| 107 131 | 
             
                      "--",
         | 
| @@ -123,7 +147,7 @@ module Nicetest | |
| 123 147 |  | 
| 124 148 | 
             
                def select_file_args(args)
         | 
| 125 149 | 
             
                  args = args.dup
         | 
| 126 | 
            -
                  Minitest.instance_variable_set(:@extensions, Set.new) # Avoid double-loading plugins
         | 
| 150 | 
            +
                  Minitest.instance_variable_set(:@extensions, Set.new(Minitest.extensions)) # Avoid double-loading plugins
         | 
| 127 151 | 
             
                  Minitest.load_plugins unless args.delete("--no-plugins") || ENV["MT_NO_PLUGINS"]
         | 
| 128 152 | 
             
                  # this will remove all options from the args array
         | 
| 129 153 | 
             
                  temporarily_disable_optparse_callbacks { Minitest.process_args(args) }
         | 
| @@ -131,14 +155,17 @@ module Nicetest | |
| 131 155 | 
             
                end
         | 
| 132 156 |  | 
| 133 157 | 
             
                def glob_test_files(dir)
         | 
| 134 | 
            -
                  Dir | 
| 158 | 
            +
                  Dir[
         | 
| 159 | 
            +
                    "#{dir}/**/test_*.rb",
         | 
| 160 | 
            +
                    "#{dir}/**/*_{test,spec}.rb",
         | 
| 161 | 
            +
                  ]
         | 
| 135 162 | 
             
                end
         | 
| 136 163 |  | 
| 137 164 | 
             
                def require_path_or_dir(path_or_dir)
         | 
| 138 165 | 
             
                  if path_or_dir.end_with?(".rb")
         | 
| 139 166 | 
             
                    [try_require(path_or_dir)]
         | 
| 140 167 | 
             
                  else
         | 
| 141 | 
            -
                     | 
| 168 | 
            +
                    glob_test_files(path_or_dir).map do |f|
         | 
| 142 169 | 
             
                      try_require(f)
         | 
| 143 170 | 
             
                    end
         | 
| 144 171 | 
             
                  end
         | 
| @@ -159,7 +186,8 @@ module Nicetest | |
| 159 186 | 
             
                end
         | 
| 160 187 |  | 
| 161 188 | 
             
                def adjust_load_path!
         | 
| 162 | 
            -
                  $LOAD_PATH.unshift(File.expand_path("test"))
         | 
| 189 | 
            +
                  $LOAD_PATH.unshift(File.expand_path("test")) unless @adjusted
         | 
| 190 | 
            +
                  @adjusted = true
         | 
| 163 191 | 
             
                end
         | 
| 164 192 |  | 
| 165 193 | 
             
                def temporarily_disable_optparse_callbacks(&blk)
         | 
| @@ -190,9 +218,8 @@ module Nicetest | |
| 190 218 | 
             
                          options[:cd] = dir
         | 
| 191 219 | 
             
                        end
         | 
| 192 220 |  | 
| 193 | 
            -
                        opts.on("-- | 
| 194 | 
            -
                           | 
| 195 | 
            -
                          exit
         | 
| 221 | 
            +
                        opts.on("-n", "--name=PATTERN", "Filter test names on pattern") do |pattern|
         | 
| 222 | 
            +
                          options[:name] = pattern
         | 
| 196 223 | 
             
                        end
         | 
| 197 224 | 
             
                      end
         | 
| 198 225 |  | 
    
        data/lib/nicetest/test_finder.rb
    CHANGED
    
    | @@ -23,7 +23,8 @@ module Nicetest | |
| 23 23 |  | 
| 24 24 | 
             
                def find_test(filename, lineno)
         | 
| 25 25 | 
             
                  range_finder = @parse_cache[filename] ||= RangeFinder.parse_file(filename)
         | 
| 26 | 
            -
                  range_finder.nearest_test_for_line(lineno)
         | 
| 26 | 
            +
                  regexp = range_finder.nearest_test_for_line(lineno)
         | 
| 27 | 
            +
                  "^#{regexp}$" if regexp
         | 
| 27 28 | 
             
                rescue => e
         | 
| 28 29 | 
             
                  Nicetest.logger.warn("Failed to parse #{filename} (#{e.class}: #{e.message})")
         | 
| 29 30 | 
             
                  nil
         | 
    
        data/lib/nicetest/version.rb
    CHANGED
    
    
    
        data/lib/nicetest.rb
    CHANGED
    
    | @@ -8,6 +8,9 @@ require_relative "nicetest/logger" | |
| 8 8 | 
             
            require_relative "nicetest/cli"
         | 
| 9 9 | 
             
            require_relative "nicetest/backtrace_filter"
         | 
| 10 10 | 
             
            require_relative "nicetest/test_finder"
         | 
| 11 | 
            +
            require_relative "minitest/nicetest_plugin"
         | 
| 12 | 
            +
            require_relative "minitest/reporters_plugin"
         | 
| 13 | 
            +
            require_relative "minitest/superdiff_plugin"
         | 
| 11 14 |  | 
| 12 15 | 
             
            module Nicetest
         | 
| 13 16 | 
             
              class Error < StandardError; end
         | 
    
        data.tar.gz.sig
    CHANGED
    
    | Binary file | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: nicetest
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.1. | 
| 4 | 
            +
              version: 0.1.5
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Ian Ker-Seymer
         | 
| @@ -29,8 +29,50 @@ cert_chain: | |
| 29 29 | 
             
              Lvd35BNvZkhFzs9xfykhurpkT2TiP2F3ZFn9dwLXMFe41pwrtEYLIWhYi8mUG4Ek
         | 
| 30 30 | 
             
              6aR8M/tqIpChVV39
         | 
| 31 31 | 
             
              -----END CERTIFICATE-----
         | 
| 32 | 
            -
            date:  | 
| 32 | 
            +
            date: 2025-01-11 00:00:00.000000000 Z
         | 
| 33 33 | 
             
            dependencies:
         | 
| 34 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 35 | 
            +
              name: base64
         | 
| 36 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 37 | 
            +
                requirements:
         | 
| 38 | 
            +
                - - ">="
         | 
| 39 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 40 | 
            +
                    version: '0'
         | 
| 41 | 
            +
              type: :runtime
         | 
| 42 | 
            +
              prerelease: false
         | 
| 43 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 44 | 
            +
                requirements:
         | 
| 45 | 
            +
                - - ">="
         | 
| 46 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 47 | 
            +
                    version: '0'
         | 
| 48 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 49 | 
            +
              name: bigdecimal
         | 
| 50 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 51 | 
            +
                requirements:
         | 
| 52 | 
            +
                - - ">="
         | 
| 53 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 54 | 
            +
                    version: '0'
         | 
| 55 | 
            +
              type: :runtime
         | 
| 56 | 
            +
              prerelease: false
         | 
| 57 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 58 | 
            +
                requirements:
         | 
| 59 | 
            +
                - - ">="
         | 
| 60 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 61 | 
            +
                    version: '0'
         | 
| 62 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 63 | 
            +
              name: logger
         | 
| 64 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 65 | 
            +
                requirements:
         | 
| 66 | 
            +
                - - ">="
         | 
| 67 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 68 | 
            +
                    version: '0'
         | 
| 69 | 
            +
              type: :runtime
         | 
| 70 | 
            +
              prerelease: false
         | 
| 71 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 72 | 
            +
                requirements:
         | 
| 73 | 
            +
                - - ">="
         | 
| 74 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 75 | 
            +
                    version: '0'
         | 
| 34 76 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 35 77 | 
             
              name: minitest
         | 
| 36 78 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -170,7 +212,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 170 212 | 
             
                - !ruby/object:Gem::Version
         | 
| 171 213 | 
             
                  version: '0'
         | 
| 172 214 | 
             
            requirements: []
         | 
| 173 | 
            -
            rubygems_version: 3.5. | 
| 215 | 
            +
            rubygems_version: 3.5.22
         | 
| 174 216 | 
             
            signing_key:
         | 
| 175 217 | 
             
            specification_version: 4
         | 
| 176 218 | 
             
            summary: A slightly fancier configuration for Minitest
         | 
    
        metadata.gz.sig
    CHANGED
    
    | Binary file |