Skip to content

Commit

Permalink
Fix run of only one selected test
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexB52 committed Nov 24, 2024
1 parent 37c3655 commit b315504
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions lib/retest/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,17 @@ def run_all
end

def format_instruction(changed_files: [], test_files: [])
if test_files.size >=2
if changed_files.size == 0 && test_files.size >= 1
instruction = command.clone(all: false).to_s
tests_string = command.format_batch(*test_files)
log("Tests selected:")
test_files.each { |test_file| log(" - #{test_file}") }

instruction.gsub!('<test>', tests_string)
else
instruction = command.to_s
instruction = format_changed_files(instruction: instruction, files: changed_files)
instruction = format_test_files(instruction: instruction, files: test_files)
return instruction.gsub('<test>', tests_string)
end

log("\n")
instruction
instruction = command.to_s
instruction = format_changed_files(instruction: instruction, files: changed_files)
instruction = format_test_files(instruction: instruction, files: test_files)
end

def format_test_files(instruction:, files:)
Expand Down Expand Up @@ -84,6 +80,7 @@ def print_test_file_not_found
end

def system_run(command)
log("\n")
result = system(command) ? :tests_pass : :tests_fail
changed
notify_observers(result)
Expand Down

0 comments on commit b315504

Please sign in to comment.