Module: Bulldogger::Preflight
- Defined in:
- lib/bulldogger/preflight.rb
Overview
Compares application frames from two isolated command runs. It does not select tests or change command arguments.
Class Method Summary collapse
Class Method Details
.run(command, stdout: $stdout, stderr: $stderr) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/bulldogger/preflight.rb', line 13 def run(command, stdout: $stdout, stderr: $stderr) raise ArgumentError, "preflight requires a command after --" if command.empty? first_path = collect(command) second_path = collect(command) first_frames = application_frames(first_path) second_frames = application_frames(second_path) if first_frames == second_frames stdout.puts "bulldogger preflight: deterministic (app frames: #{first_frames.length})" stdout.puts "bulldogger preflight indexes: #{first_path} #{second_path}" return 0 end divergence = first_divergence(first_frames, second_frames) stdout.puts "bulldogger preflight: first divergence at event #{divergence + 1}" stdout.puts "first: #{format_frame(first_frames[divergence])}" stdout.puts "second: #{format_frame(second_frames[divergence])}" stdout.puts "app frames: #{first_frames.length} and #{second_frames.length}" stdout.puts "This test is not eligible for bulldogger re-execution." 1 rescue SystemCallError, IOError, JSON::ParserError => error stderr.puts "bulldogger preflight: failed to start or collect the command: #{error.}" 2 end |