Sha256: d3969edcb682d57dc7c32bb7c1def09f871627e115600929b116627c6749277f

Contents?: true

Size: 1.22 KB

Versions: 37

Compression:

Stored size: 1.22 KB

Contents

module KnapsackPro
  module Runners
    class TestUnitRunner < BaseRunner
      def self.run(args)
        ENV['KNAPSACK_PRO_TEST_SUITE_TOKEN'] = KnapsackPro::Config::Env.test_suite_token_test_unit
        ENV['KNAPSACK_PRO_RECORDING_ENABLED'] = 'true'

        adapter_class = KnapsackPro::Adapters::TestUnitAdapter
        KnapsackPro::Config::Env.set_test_runner_adapter(adapter_class)
        runner = new(adapter_class)

        if runner.test_files_to_execute_exist?
          adapter_class.verify_bind_method_called

          KnapsackPro.tracker.set_prerun_tests(runner.test_file_paths)

          cli_args =
            (args || '').split +
            runner.test_file_paths.map do |f|
              File.expand_path(f)
            end

          exit test_unit_autorunner_run(
            true,
            runner.test_dir,
            cli_args
          )
        end
      end

      private

      # https://www.rubydoc.info/github/test-unit/test-unit/Test/Unit/AutoRunner#run-class_method
      def self.test_unit_autorunner_run(force_standalone, default_dir, argv)
        require 'test/unit'

        ::Test::Unit::AutoRunner.run(
          force_standalone,
          default_dir,
          argv
        )
      end
    end
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
knapsack_pro-3.8.0 lib/knapsack_pro/runners/test_unit_runner.rb
knapsack_pro-3.7.0 lib/knapsack_pro/runners/test_unit_runner.rb
knapsack_pro-3.6.0 lib/knapsack_pro/runners/test_unit_runner.rb
knapsack_pro-3.5.0 lib/knapsack_pro/runners/test_unit_runner.rb
knapsack_pro-3.4.2 lib/knapsack_pro/runners/test_unit_runner.rb
knapsack_pro-3.4.1 lib/knapsack_pro/runners/test_unit_runner.rb
knapsack_pro-3.4.0 lib/knapsack_pro/runners/test_unit_runner.rb
knapsack_pro-3.3.1 lib/knapsack_pro/runners/test_unit_runner.rb
knapsack_pro-3.3.0 lib/knapsack_pro/runners/test_unit_runner.rb
knapsack_pro-3.2.1 lib/knapsack_pro/runners/test_unit_runner.rb
knapsack_pro-3.2.0 lib/knapsack_pro/runners/test_unit_runner.rb
knapsack_pro-3.1.3 lib/knapsack_pro/runners/test_unit_runner.rb
knapsack_pro-3.1.2 lib/knapsack_pro/runners/test_unit_runner.rb
knapsack_pro-3.1.1 lib/knapsack_pro/runners/test_unit_runner.rb
knapsack_pro-3.1.0 lib/knapsack_pro/runners/test_unit_runner.rb
knapsack_pro-3.0.0 lib/knapsack_pro/runners/test_unit_runner.rb
knapsack_pro-2.18.2 lib/knapsack_pro/runners/test_unit_runner.rb