knapsack_pro 2.1.0 → 2.1.1
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
- data/CHANGELOG.md +8 -0
- data/README.md +1 -1
- data/lib/knapsack_pro/adapters/cucumber_adapter.rb +1 -1
- data/lib/knapsack_pro/adapters/minitest_adapter.rb +3 -3
- data/lib/knapsack_pro/adapters/rspec_adapter.rb +1 -1
- data/lib/knapsack_pro/adapters/test_unit_adapter.rb +2 -2
- data/lib/knapsack_pro/base_allocator_builder.rb +1 -1
- data/lib/knapsack_pro/formatters/rspec_json_formatter.rb +2 -2
- data/lib/knapsack_pro/formatters/rspec_queue_profile_formatter_extension.rb +1 -1
- data/lib/knapsack_pro/formatters/rspec_queue_summary_formatter.rb +2 -2
- data/lib/knapsack_pro/runners/cucumber_runner.rb +1 -1
- data/lib/knapsack_pro/runners/queue/minitest_runner.rb +2 -2
- data/lib/knapsack_pro/runners/queue/rspec_runner.rb +11 -11
- data/lib/knapsack_pro/runners/rspec_runner.rb +1 -1
- data/lib/knapsack_pro/runners/test_unit_runner.rb +1 -1
- data/lib/knapsack_pro/test_case_detectors/rspec_test_example_detector.rb +3 -3
- data/lib/knapsack_pro/version.rb +1 -1
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 653a964b0c75547cec30531146adeb0075f251e6bc6511d4d85d710b778cf539
         | 
| 4 | 
            +
              data.tar.gz: 21bb3baafa53c8dcc609d87e8fd8adb2b700df40f3275908968dee74f4186921
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: a09a6f1318b285910c1db3eb8828a2d79034cfd7a1cf23926995b91b89d68f768bdab003f33ee4fc1480c1431fd22cffe6236bc69413494147bc9d12619ee73e
         | 
| 7 | 
            +
              data.tar.gz: 1aa7010f7a371a8dca1f333a1254261341bfec1143e101dc2e6a717aa0dac43f31f4382050da248bb87a387268bd2ef39eeeb64ed76f348293dd5efafe9607e3
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -1,5 +1,13 @@ | |
| 1 1 | 
             
            # Change Log
         | 
| 2 2 |  | 
| 3 | 
            +
            ### 2.1.1
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            * Explicitly call root test runner class to avoid a confusing error when test runner gem is not loaded
         | 
| 6 | 
            +
             | 
| 7 | 
            +
                https://github.com/KnapsackPro/knapsack_pro-ruby/pull/120
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v2.1.0...v2.1.1
         | 
| 10 | 
            +
             | 
| 3 11 | 
             
            ### 2.1.0
         | 
| 4 12 |  | 
| 5 13 | 
             
            * Add `KNAPSACK_PRO_RSPEC_TEST_EXAMPLE_DETECTOR_PREFIX` to customize prefix for generating test examples report when using RSpec split by test examples
         | 
    
        data/README.md
    CHANGED
    
    | @@ -627,7 +627,7 @@ If you will see error like: | |
| 627 627 | 
             
            Don't know how to build task 'knapsack_pro:rspec_test_example_detector' (See the list of available tasks with `rake --tasks`)
         | 
| 628 628 | 
             
            ```
         | 
| 629 629 |  | 
| 630 | 
            -
            It probably means bundler can't find the rake task. You can try remove default prefix `bundle exec` used by knapsack_pro gem by setting `KNAPSACK_PRO_RSPEC_TEST_EXAMPLE_DETECTOR_PREFIX=""`.
         | 
| 630 | 
            +
            It probably means bundler can't find the rake task. You can try to remove the default prefix `bundle exec` used by knapsack_pro gem by setting `KNAPSACK_PRO_RSPEC_TEST_EXAMPLE_DETECTOR_PREFIX=""`.
         | 
| 631 631 |  | 
| 632 632 | 
             
            ### How to manually define a list of slow test files to be split by test cases
         | 
| 633 633 |  | 
| @@ -85,10 +85,10 @@ module KnapsackPro | |
| 85 85 | 
             
                  private
         | 
| 86 86 |  | 
| 87 87 | 
             
                  def add_post_run_callback(&block)
         | 
| 88 | 
            -
                    if Minitest.respond_to?(:after_run)
         | 
| 89 | 
            -
                      Minitest.after_run { block.call }
         | 
| 88 | 
            +
                    if ::Minitest.respond_to?(:after_run)
         | 
| 89 | 
            +
                      ::Minitest.after_run { block.call }
         | 
| 90 90 | 
             
                    else
         | 
| 91 | 
            -
                      Minitest::Unit.after_tests { block.call }
         | 
| 91 | 
            +
                      ::Minitest::Unit.after_tests { block.call }
         | 
| 92 92 | 
             
                    end
         | 
| 93 93 | 
             
                  end
         | 
| 94 94 | 
             
                end
         | 
| @@ -4,7 +4,7 @@ module KnapsackPro | |
| 4 4 | 
             
                  TEST_DIR_PATTERN = 'spec/**{,/*/**}/*_spec.rb'
         | 
| 5 5 |  | 
| 6 6 | 
             
                  def self.test_path(example_group)
         | 
| 7 | 
            -
                    if defined?(Turnip) && Turnip::VERSION.to_i < 2
         | 
| 7 | 
            +
                    if defined?(::Turnip) && ::Turnip::VERSION.to_i < 2
         | 
| 8 8 | 
             
                      unless example_group[:turnip]
         | 
| 9 9 | 
             
                        until example_group[:parent_example_group].nil?
         | 
| 10 10 | 
             
                          example_group = example_group[:parent_example_group]
         | 
| @@ -42,7 +42,7 @@ module KnapsackPro | |
| 42 42 | 
             
                  end
         | 
| 43 43 |  | 
| 44 44 | 
             
                  def bind_time_tracker
         | 
| 45 | 
            -
                    Test::Unit::TestSuite.send(:prepend, BindTimeTrackerTestUnitPlugin)
         | 
| 45 | 
            +
                    ::Test::Unit::TestSuite.send(:prepend, BindTimeTrackerTestUnitPlugin)
         | 
| 46 46 |  | 
| 47 47 | 
             
                    add_post_run_callback do
         | 
| 48 48 | 
             
                      KnapsackPro.logger.debug(KnapsackPro::Presenter.global_time)
         | 
| @@ -63,7 +63,7 @@ module KnapsackPro | |
| 63 63 | 
             
                  private
         | 
| 64 64 |  | 
| 65 65 | 
             
                  def add_post_run_callback(&block)
         | 
| 66 | 
            -
                    Test::Unit.at_exit do
         | 
| 66 | 
            +
                    ::Test::Unit.at_exit do
         | 
| 67 67 | 
             
                      block.call
         | 
| 68 68 | 
             
                    end
         | 
| 69 69 | 
             
                  end
         | 
| @@ -34,7 +34,7 @@ module KnapsackPro | |
| 34 34 | 
             
                  test_files_to_run = all_test_files_to_run
         | 
| 35 35 |  | 
| 36 36 | 
             
                  if adapter_class == KnapsackPro::Adapters::RSpecAdapter && KnapsackPro::Config::Env.rspec_split_by_test_examples?
         | 
| 37 | 
            -
                    unless Gem::Version.new(RSpec::Core::Version::STRING) >= Gem::Version.new('3.3.0')
         | 
| 37 | 
            +
                    unless Gem::Version.new(::RSpec::Core::Version::STRING) >= Gem::Version.new('3.3.0')
         | 
| 38 38 | 
             
                      raise 'RSpec >= 3.3.0 is required to split test files by test examples. Learn more: https://github.com/KnapsackPro/knapsack_pro-ruby#split-test-files-by-test-cases'
         | 
| 39 39 | 
             
                    end
         | 
| 40 40 |  | 
| @@ -3,8 +3,8 @@ RSpec::Support.require_rspec_core('formatters/json_formatter') | |
| 3 3 | 
             
            # based on https://github.com/rspec/rspec-core/blob/master/lib/rspec/core/formatters/json_formatter.rb
         | 
| 4 4 | 
             
            module KnapsackPro
         | 
| 5 5 | 
             
              module Formatters
         | 
| 6 | 
            -
                class RSpecJsonFormatter < RSpec::Core::Formatters::JsonFormatter
         | 
| 7 | 
            -
                  RSpec::Core::Formatters.register self
         | 
| 6 | 
            +
                class RSpecJsonFormatter < ::RSpec::Core::Formatters::JsonFormatter
         | 
| 7 | 
            +
                  ::RSpec::Core::Formatters.register self
         | 
| 8 8 |  | 
| 9 9 | 
             
                  private
         | 
| 10 10 |  | 
| @@ -5,7 +5,7 @@ module KnapsackPro | |
| 5 5 | 
             
                module RSpecQueueProfileFormatterExtension
         | 
| 6 6 | 
             
                  def self.print_summary
         | 
| 7 7 | 
             
                    return unless KnapsackPro::Config::Env.modify_default_rspec_formatters?
         | 
| 8 | 
            -
                    RSpec::Core::Formatters::ProfileFormatter.print_profile_summary
         | 
| 8 | 
            +
                    ::RSpec::Core::Formatters::ProfileFormatter.print_profile_summary
         | 
| 9 9 | 
             
                  end
         | 
| 10 10 |  | 
| 11 11 | 
             
                  def initialize(output)
         | 
| @@ -9,8 +9,8 @@ module KnapsackPro | |
| 9 9 | 
             
                  def dump_summary(summary); end
         | 
| 10 10 | 
             
                end
         | 
| 11 11 |  | 
| 12 | 
            -
                class RSpecQueueSummaryFormatter < RSpec::Core::Formatters::BaseFormatter
         | 
| 13 | 
            -
                  RSpec::Core::Formatters.register self, :dump_summary, :dump_failures, :dump_pending
         | 
| 12 | 
            +
                class RSpecQueueSummaryFormatter < ::RSpec::Core::Formatters::BaseFormatter
         | 
| 13 | 
            +
                  ::RSpec::Core::Formatters.register self, :dump_summary, :dump_failures, :dump_pending
         | 
| 14 14 |  | 
| 15 15 | 
             
                  def self.registered_output=(output)
         | 
| 16 16 | 
             
                    @registered_output = {
         | 
| @@ -15,7 +15,7 @@ module KnapsackPro | |
| 15 15 | 
             
                        Rake::Task[task_name].clear
         | 
| 16 16 | 
             
                      end
         | 
| 17 17 |  | 
| 18 | 
            -
                      Cucumber::Rake::Task.new(task_name) do |t|
         | 
| 18 | 
            +
                      ::Cucumber::Rake::Task.new(task_name) do |t|
         | 
| 19 19 | 
             
                        t.cucumber_opts = "#{args} --require #{runner.test_dir} -- #{runner.stringify_test_file_paths}"
         | 
| 20 20 | 
             
                      end
         | 
| 21 21 | 
             
                      Rake::Task[task_name].invoke
         | 
| @@ -79,8 +79,8 @@ module KnapsackPro | |
| 79 79 |  | 
| 80 80 | 
             
                        log_rspec_command(args, test_file_paths, :subset_queue)
         | 
| 81 81 |  | 
| 82 | 
            -
                        options = RSpec::Core::ConfigurationOptions.new(cli_args)
         | 
| 83 | 
            -
                        exit_code = RSpec::Core::Runner.new(options).run($stderr, $stdout)
         | 
| 82 | 
            +
                        options = ::RSpec::Core::ConfigurationOptions.new(cli_args)
         | 
| 83 | 
            +
                        exit_code = ::RSpec::Core::Runner.new(options).run($stderr, $stdout)
         | 
| 84 84 | 
             
                        exitstatus = exit_code if exit_code != 0
         | 
| 85 85 |  | 
| 86 86 | 
             
                        rspec_clear_examples
         | 
| @@ -124,26 +124,26 @@ module KnapsackPro | |
| 124 124 | 
             
                    #
         | 
| 125 125 | 
             
                    # Keep formatters and report to accumulate info about failed/pending tests
         | 
| 126 126 | 
             
                    def self.rspec_clear_examples
         | 
| 127 | 
            -
                      if RSpec::ExampleGroups.respond_to?(:remove_all_constants)
         | 
| 128 | 
            -
                        RSpec::ExampleGroups.remove_all_constants
         | 
| 127 | 
            +
                      if ::RSpec::ExampleGroups.respond_to?(:remove_all_constants)
         | 
| 128 | 
            +
                        ::RSpec::ExampleGroups.remove_all_constants
         | 
| 129 129 | 
             
                      else
         | 
| 130 | 
            -
                        RSpec::ExampleGroups.constants.each do |constant|
         | 
| 131 | 
            -
                          RSpec::ExampleGroups.__send__(:remove_const, constant)
         | 
| 130 | 
            +
                        ::RSpec::ExampleGroups.constants.each do |constant|
         | 
| 131 | 
            +
                          ::RSpec::ExampleGroups.__send__(:remove_const, constant)
         | 
| 132 132 | 
             
                        end
         | 
| 133 133 | 
             
                      end
         | 
| 134 | 
            -
                      RSpec.world.example_groups.clear
         | 
| 135 | 
            -
                      RSpec.configuration.start_time = ::RSpec::Core::Time.now
         | 
| 134 | 
            +
                      ::RSpec.world.example_groups.clear
         | 
| 135 | 
            +
                      ::RSpec.configuration.start_time = ::RSpec::Core::Time.now
         | 
| 136 136 |  | 
| 137 137 | 
             
                      if KnapsackPro::Config::Env.rspec_split_by_test_examples?
         | 
| 138 138 | 
             
                        # Reset example group counts to ensure scoped example ids in metadata
         | 
| 139 139 | 
             
                        # have correct index (not increased by each subsequent run).
         | 
| 140 140 | 
             
                        # Solves this problem: https://github.com/rspec/rspec-core/issues/2721
         | 
| 141 | 
            -
                        RSpec.world.instance_variable_set(:@example_group_counts_by_spec_file, Hash.new(0))
         | 
| 141 | 
            +
                        ::RSpec.world.instance_variable_set(:@example_group_counts_by_spec_file, Hash.new(0))
         | 
| 142 142 | 
             
                      end
         | 
| 143 143 |  | 
| 144 144 | 
             
                      # skip reset filters for old RSpec versions
         | 
| 145 | 
            -
                      if RSpec.configuration.respond_to?(:reset_filters)
         | 
| 146 | 
            -
                        RSpec.configuration.reset_filters
         | 
| 145 | 
            +
                      if ::RSpec.configuration.respond_to?(:reset_filters)
         | 
| 146 | 
            +
                        ::RSpec.configuration.reset_filters
         | 
| 147 147 | 
             
                      end
         | 
| 148 148 | 
             
                    end
         | 
| 149 149 | 
             
                  end
         | 
| @@ -15,7 +15,7 @@ module KnapsackPro | |
| 15 15 | 
             
                        Rake::Task[task_name].clear
         | 
| 16 16 | 
             
                      end
         | 
| 17 17 |  | 
| 18 | 
            -
                      RSpec::Core::RakeTask.new(task_name) do |t|
         | 
| 18 | 
            +
                      ::RSpec::Core::RakeTask.new(task_name) do |t|
         | 
| 19 19 | 
             
                        # we cannot pass runner.test_file_paths array to t.pattern
         | 
| 20 20 | 
             
                        # because pattern does not accept test example path like spec/a_spec.rb[1:2]
         | 
| 21 21 | 
             
                        # instead we pass test files and test example paths to t.rspec_opts
         | 
| @@ -7,7 +7,7 @@ module KnapsackPro | |
| 7 7 | 
             
                    require 'rspec/core'
         | 
| 8 8 |  | 
| 9 9 | 
             
                    cli_format =
         | 
| 10 | 
            -
                      if Gem::Version.new(RSpec::Core::Version::STRING) < Gem::Version.new('3.6.0')
         | 
| 10 | 
            +
                      if Gem::Version.new(::RSpec::Core::Version::STRING) < Gem::Version.new('3.6.0')
         | 
| 11 11 | 
             
                        require_relative '../formatters/rspec_json_formatter'
         | 
| 12 12 | 
             
                        ['--format', KnapsackPro::Formatters::RSpecJsonFormatter.to_s]
         | 
| 13 13 | 
             
                      else
         | 
| @@ -30,8 +30,8 @@ module KnapsackPro | |
| 30 30 | 
             
                      '--out', report_path,
         | 
| 31 31 | 
             
                      '--default-path', test_dir,
         | 
| 32 32 | 
             
                    ] + KnapsackPro::TestFilePresenter.paths(test_file_entities)
         | 
| 33 | 
            -
                    options = RSpec::Core::ConfigurationOptions.new(cli_args)
         | 
| 34 | 
            -
                    exit_code = RSpec::Core::Runner.new(options).run($stderr, $stdout)
         | 
| 33 | 
            +
                    options = ::RSpec::Core::ConfigurationOptions.new(cli_args)
         | 
| 34 | 
            +
                    exit_code = ::RSpec::Core::Runner.new(options).run($stderr, $stdout)
         | 
| 35 35 | 
             
                    if exit_code != 0
         | 
| 36 36 | 
             
                      raise 'There was problem to generate test examples for test suite'
         | 
| 37 37 | 
             
                    end
         | 
    
        data/lib/knapsack_pro/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: knapsack_pro
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 2.1. | 
| 4 | 
            +
              version: 2.1.1
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - ArturT
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2020-07- | 
| 11 | 
            +
            date: 2020-07-18 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: rake
         |