Sha256: 4bd3f07026d147fab6c3c49059bf9115940a1fcffba7716ca5e70eff4cca2387

Contents?: true

Size: 701 Bytes

Versions: 12

Compression:

Stored size: 701 Bytes

Contents

require 'parallel_tests/gherkin/io'

module ParallelTests
  module Gherkin
    class RuntimeLogger
      include Io

      def initialize(config)
        @io = prepare_io(config.out_stream)
        @example_times = Hash.new(0)

        config.on_event :test_case_started do |_|
          @start_at = ParallelTests.now.to_f
        end

        config.on_event :test_case_finished do |event|
          @example_times[event.test_case.feature.file] += ParallelTests.now.to_f - @start_at
        end

        config.on_event :test_run_finished do |_|
          lock_output do
            @io.puts @example_times.map { |file, time| "#{file}:#{time}" }
          end
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
parallel_tests-2.32.0 lib/parallel_tests/gherkin/runtime_logger.rb
parallel_tests-2.31.0 lib/parallel_tests/gherkin/runtime_logger.rb
parallel_tests-2.30.1 lib/parallel_tests/gherkin/runtime_logger.rb
parallel_tests-2.30.0 lib/parallel_tests/gherkin/runtime_logger.rb
parallel_tests-2.29.2 lib/parallel_tests/gherkin/runtime_logger.rb
parallel_tests-2.29.1 lib/parallel_tests/gherkin/runtime_logger.rb
parallel_tests-2.29.0 lib/parallel_tests/gherkin/runtime_logger.rb
parallel_tests-2.28.0 lib/parallel_tests/gherkin/runtime_logger.rb
parallel_tests-2.27.1 lib/parallel_tests/gherkin/runtime_logger.rb
parallel_tests-2.27.0 lib/parallel_tests/gherkin/runtime_logger.rb
parallel_tests-2.26.2 lib/parallel_tests/gherkin/runtime_logger.rb
parallel_tests-2.26.0 lib/parallel_tests/gherkin/runtime_logger.rb