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 3c6435e
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,23 @@

config.verbose_retry = true
config.display_try_failure_messages = true
config.default_sleep_interval = 1 if RUBY_ENGINE == 'jruby'
config.around :each, :js do |example|
example.run_with_retry retry: (ENV['CI'] && RUBY_ENGINE == 'jruby' ? 3 : 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 >= 3

sleep attempt
retry
end
end
end

config.before(:all) do
Expand Down

0 comments on commit 3c6435e

Please sign in to comment.