Sha256: 6c744166900052b050ca21ffc2dec28b3fc011a5fc5b4d818458d3134999ed14

Contents?: true

Size: 902 Bytes

Versions: 41

Compression:

Stored size: 902 Bytes

Contents

require 'parallel_tests/rspec/logger_base'

class ParallelTests::RSpec::RuntimeLogger < ParallelTests::RSpec::LoggerBase
  def initialize(*args)
    super
    @example_times = Hash.new(0)
  end

  def example_started(*args)
    @time = Time.now
  end

  def example_passed(example)
    file = example.location.split(':').first
    @example_times[file] += Time.now - @time
  end

  def dump_summary(*args);end
  def dump_failures(*args);end
  def dump_failure(*args);end
  def dump_pending(*args);end

  def start_dump(*args)
    return unless ENV['TEST_ENV_NUMBER'] #only record when running in parallel
    # TODO: Figure out why sometimes time can be less than 0
    lock_output do
      @example_times.each do |file, time|
        relative_path = file.sub(/^#{Regexp.escape Dir.pwd}\//,'')
        @output.puts "#{relative_path}:#{time > 0 ? time : 0}"
      end
    end
    @output.flush
  end
end

Version data entries

41 entries across 41 versions & 2 rubygems

Version Path
parallel_tests-0.12.0 lib/parallel_tests/rspec/runtime_logger.rb
parallel_tests-0.11.6 lib/parallel_tests/rspec/runtime_logger.rb
parallel_tests-0.11.5 lib/parallel_tests/rspec/runtime_logger.rb
parallel_tests-0.11.4 lib/parallel_tests/rspec/runtime_logger.rb
parallel_tests-0.11.3 lib/parallel_tests/rspec/runtime_logger.rb
parallel_tests-0.11.2 lib/parallel_tests/rspec/runtime_logger.rb
parallel_tests-0.11.1 lib/parallel_tests/rspec/runtime_logger.rb
parallel_tests-0.11.0 lib/parallel_tests/rspec/runtime_logger.rb
parallel_tests-0.10.4 lib/parallel_tests/rspec/runtime_logger.rb
parallel_tests-0.10.3 lib/parallel_tests/rspec/runtime_logger.rb
parallel_tests-0.10.2 lib/parallel_tests/rspec/runtime_logger.rb
parallel_tests-0.10.1 lib/parallel_tests/rspec/runtime_logger.rb
friendlyfashion-parallel_tests-0.9.0 lib/parallel_tests/rspec/runtime_logger.rb
parallel_tests-0.10.0 lib/parallel_tests/rspec/runtime_logger.rb
parallel_tests-0.9.4 lib/parallel_tests/rspec/runtime_logger.rb
parallel_tests-0.9.3 lib/parallel_tests/rspec/runtime_logger.rb
parallel_tests-0.9.2 lib/parallel_tests/rspec/runtime_logger.rb
parallel_tests-0.9.1 lib/parallel_tests/rspec/runtime_logger.rb
parallel_tests-0.9.0 lib/parallel_tests/rspec/runtime_logger.rb
parallel_tests-0.8.14 lib/parallel_tests/rspec/runtime_logger.rb