Sha256: ef0e388a1674f25ade2bee63018166873c4fa402eceaa0a75b5663c41f2bd822

Contents?: true

Size: 1 KB

Versions: 37

Compression:

Stored size: 1 KB

Contents

module Autotest::Preload
  def self.glob
    @glob
  end

  def self.glob= o
    @glob = o
  end

  self.glob = "test/test_helper.rb"

  Autotest.add_hook :post_initialize do |at, *args|
    at.add_sigquit_handler

    warn "pre-loading initializers"
    t0 = Time.now
    Dir[self.glob].each do |path|
      require path
    end
    warn "done pre-loading initializers in %.2f seconds" % [Time.now - t0]

    false
  end
end

class Autotest
  alias :old_run_tests :run_tests

  def run_tests
    hook :run_command

    new_mtime = self.find_files_to_test
    return unless new_mtime
    self.last_mtime = new_mtime

    begin
      # TODO: deal with unit_diff and partial test runs later
      original_argv = ARGV.dup
      ARGV.clear

      @child = fork do
        trap "QUIT", "DEFAULT"
        trap "INT", "DEFAULT"
        files_to_test.keys.each do |file|
          load file
        end
      end
      Process.wait
    ensure
      @child = nil
      ARGV.replace original_argv
    end

    hook :ran_command
  end
end

Version data entries

37 entries across 37 versions & 9 rubygems

Version Path
cloudsmith-api-0.44.4 vendor/bundle/ruby/2.3.0/gems/ZenTest-4.11.2/lib/autotest/preload.rb
dadapush_client-1.0.1 vendor/bundle/ruby/2.3.0/gems/ZenTest-4.11.2/lib/autotest/preload.rb
minitest-autotest-1.1.1 lib/autotest/preload.rb
minitest-autotest-1.1.0 lib/autotest/preload.rb
ZenTest-4.11.2 lib/autotest/preload.rb
cloudsmith-api-0.30.7 vendor/bundle/ruby/2.3.0/gems/ZenTest-4.11.1/lib/autotest/preload.rb
color_me_shop-1.0.0 vendor/bundle/ruby/2.5.0/gems/ZenTest-4.11.1/lib/autotest/preload.rb
cloudsmith-api-0.21.4 vendor/bundle/ruby/2.3.0/gems/ZenTest-4.11.1/lib/autotest/preload.rb
ZenTest-4.11.1 lib/autotest/preload.rb
minitest-autotest-1.0.3 lib/autotest/preload.rb
dwolla_swagger-1.0.6 vendor/bundle/ruby/2.2.0/gems/ZenTest-4.11.0/lib/autotest/preload.rb
minitest-autotest-1.0.2 lib/autotest/preload.rb
minitest-autotest-1.0.1 lib/autotest/preload.rb
minitest-autotest-1.0.0 lib/autotest/preload.rb
ZenTest-4.11.0 lib/autotest/preload.rb
minitest-autotest-1.0.0.b.1 lib/autotest/preload.rb
ZenTest-4.10.1 lib/autotest/preload.rb
ZenTest-4.10.0 lib/autotest/preload.rb
ZenTest-4.9.5 lib/autotest/preload.rb
ZenTest-4.9.4 lib/autotest/preload.rb