Sha256: e99008364219523e852dd3a0cbf97666c686f3c9563f6b1330c26d337e072b20
Contents?: true
Size: 1.61 KB
Versions: 9
Compression:
Stored size: 1.61 KB
Contents
# frozen_string_literal: true require 'yaml' module LearnTest class Runner attr_reader :repo, :options def initialize(repo, options = {}) @repo = repo @options = options die unless strategy end 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 def files @files ||= Dir.entries('.') end def keep_results? @keep_results ||= options[:keep] || !!options.delete('--keep') end def strategy @strategy ||= strategies.map { |s| s.new(self) }.detect(&:detect) end private 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 def strategies [ LearnTest::Strategies::CSharpNunit, LearnTest::Strategies::Rspec, LearnTest::Strategies::Karma, LearnTest::Strategies::Protractor, LearnTest::Strategies::JavaJunit, LearnTest::Strategies::Mocha, LearnTest::Strategies::Pytest ] end def help_option_present? options.include?('-h') || options.include?('--help') end def local_test_run? options.include?('-h') || options.include?('--local') end def die puts "This directory doesn't appear to have any specs in it." exit end end end
Version data entries
9 entries across 9 versions & 1 rubygems