class LearnTest::Runner

Attributes

options[R]
repo[R]

Public Class Methods

new(repo, options = {}) click to toggle source
# File lib/learn_test/runner.rb, line 9
def initialize(repo, options = {})
  @repo = repo
  @options = options
end

Public Instance Methods

files() click to toggle source
# File lib/learn_test/runner.rb, line 27
def files
  @files ||= Dir.entries('.')
end
keep_results?() click to toggle source
# File lib/learn_test/runner.rb, line 31
def keep_results?
  @keep_results ||= options[:keep] || !!options.delete('--keep')
end
run() click to toggle source
# File lib/learn_test/runner.rb, line 14
def run
  strategy.check_dependencies
  strategy.configure
  strategy.run
  if options[:debug] || options[:sync]
    report_and_clean
  else
    Process.detach(Process.fork do
      report_and_clean
    end)
  end
end
strategy() click to toggle source
# File lib/learn_test/runner.rb, line 35
def strategy
  return @strategy if @strategy

  detected = strategies.map { |s| s.new(self) }.detect(&:detect)

  @strategy = detected || LearnTest::Strategies::None.new(self)
end

Private Instance Methods

help_option_present?() click to toggle source
# File lib/learn_test/runner.rb, line 67
def help_option_present?
  options.include?('-h') || options.include?('--help')
end
local_test_run?() click to toggle source
# File lib/learn_test/runner.rb, line 71
def local_test_run?
  options.include?('-h') || options.include?('--local')
end
report_and_clean() click to toggle source
# File lib/learn_test/runner.rb, line 45
def report_and_clean
  require_relative 'reporter'

  if !help_option_present? && strategy.push_results? && !local_test_run?
    LearnTest::Reporter.report(strategy, options)
  end

  strategy.cleanup unless keep_results?
end
strategies() click to toggle source
# File lib/learn_test/runner.rb, line 55
def strategies
  [
    LearnTest::Strategies::CSharpNunit,
    LearnTest::Strategies::Rspec,
    LearnTest::Strategies::Karma,
    LearnTest::Strategies::Protractor,
    LearnTest::Strategies::JavaJunit,
    LearnTest::Strategies::Mocha,
    LearnTest::Strategies::Pytest
  ]
end