diff --git a/lib/tasks/qunit.rake b/lib/tasks/qunit.rake index 14eb3ee1a1b..bc4f35b5f70 100644 --- a/lib/tasks/qunit.rake +++ b/lib/tasks/qunit.rake @@ -20,14 +20,22 @@ task "qunit:test" => :environment do test_path = "#{Rails.root}/vendor/assets/javascripts" cmd = "phantomjs #{test_path}/run-qunit.js \"http://localhost:#{port}/qunit\"" - rake_system(cmd) + # wait for server to respond, will exception out on failure + tries = 0 + begin + rake_system(cmd) + rescue + sleep 1 + tries += 1 + retry unless tries == 5 + end # A bit of a hack until we can figure this out on Travis tries = 0 while tries < 3 && $?.exitstatus === 124 tries += 1 puts "\nTimed Out. Trying again...\n" - sh(cmd) + rake_system(cmd) end success &&= $?.success? @@ -43,4 +51,4 @@ task "qunit:test" => :environment do exit(1) end -end \ No newline at end of file +end