Exception message is missing with Capybara.raise_server_errors == true
JasonBarnabe opened this issue · comments
Meta
Capybara Version: 3.39.2
Driver Information (and browser if relevant): selenium-driver 4.12.0, Chrome
Expected Behavior
With Capybara.raise_server_errors = true
, I expect the output of my tests to include full information on any server exceptions.
Actual Behavior
Output includes exception class, stack trace, but is missing exception message. For example, if in my Rails controller I put raise 'My exception details'
, I get:
Error:
MySystemTest#test_error:
RuntimeError: {:cause=>#<Capybara::CapybaraError: Your application server raised an error - It has been raised in your test code because Capybara.raise_server_errors == true>}
app/controllers/my_controller.rb:12:in `show'
No My exception details
anywhere.
I believe this is a regression from fa978af. If I revert that, then I get the message.
Error:
MySystemTest#test_error:
RuntimeError: My exception details
app/controllers/my_controller.rb:12:in `show'
What version of ruby, and what output formatter are you using because doing the same in the Capybara test suite outputs ```
Failure/Error: raise 'My exception details'
RuntimeError:
My exception details
# ./lib/capybara/spec/test_app.rb:161:in `block in <class:TestApp>'
# ./lib/capybara/server/middleware.rb:60:in `call'
# ------------------
# --- Caused by: ---
# Capybara::CapybaraError:
# Your application server raised an error - It has been raised in your test code because Capybara.raise_server_errors == true
# ./lib/capybara/session.rb:164:in `raise_server_error!'
I'm using Ruby 3.2.2. Not sure what output formatter I'm using or how to figure it out, but I'm using minitest.
Can you produce a small self-contained example to reproduce this?