class TestBench::Runner

Attributes

executor[W]
expand_path[W]
paths[R]
telemetry[R]

Public Class Methods

build(paths, root_directory, exclude_pattern: nil) click to toggle source
# File lib/test_bench/runner.rb, line 13
def self.build paths, root_directory, exclude_pattern: nil
  telemetry = Telemetry::Registry.get TOPLEVEL_BINDING

  instance = new paths, telemetry
  instance.executor = Executor.build
  instance.expand_path = ExpandPath.build root_directory, exclude_pattern
  instance
end
call(paths, root_directory=nil, exclude_pattern: nil) click to toggle source
# File lib/test_bench/runner.rb, line 22
def self.call paths, root_directory=nil, exclude_pattern: nil
  paths = Array paths
  root_directory ||= File.dirname caller_locations[0].path

  instance = build paths, root_directory, :exclude_pattern => exclude_pattern
  instance.()
end
new(paths, telemetry) click to toggle source
# File lib/test_bench/runner.rb, line 8
def initialize paths, telemetry
  @paths = paths
  @telemetry = telemetry
end

Public Instance Methods

call() click to toggle source
# File lib/test_bench/runner.rb, line 30
def call
  telemetry.run_started

  files = gather_files
  execute files
  return telemetry.passed?

ensure
  telemetry.run_finished
end
execute(files) click to toggle source
# File lib/test_bench/runner.rb, line 47
def execute files
  executor.(files)
end
executor() click to toggle source
# File lib/test_bench/runner.rb, line 51
def executor
  @executor ||= Executor.build
end
expand_path() click to toggle source
# File lib/test_bench/runner.rb, line 55
def expand_path
  @expand_path ||= proc do [] end
end
gather_files() click to toggle source
# File lib/test_bench/runner.rb, line 41
def gather_files
  paths.flat_map do |path|
    Array expand_path.(path)
  end
end