Skip to content

Commit

Permalink
Mitigate jRuby build failures
Browse files Browse the repository at this point in the history
  • Loading branch information
mshibuya committed Nov 26, 2023
1 parent b78be36 commit f8c118c
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,21 @@
config.verbose_retry = true
config.display_try_failure_messages = true
config.around :each, :js do |example|
example.run_with_retry retry: (ENV['CI'] && RUBY_ENGINE == 'jruby' ? 3 : 2)
example.run_with_retry retry: (ENV['CI'] && RUBY_ENGINE == 'jruby' ? 5 : 2)
end
config.retry_callback = proc do |example|
Capybara.reset! if example.metadata[:js]
if example.metadata[:js]
attempt = 0
begin
Capybara.reset!
rescue Ferrum::TimeoutError, Ferrum::NoExecutionContextError
attempt += 1
raise if attempt >= 5

sleep attempt
retry
end
end
end

config.before(:all) do
Expand Down

0 comments on commit f8c118c

Please sign in to comment.