Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

raise_error matcher truncates application backtrace #153

Open
dleavitt opened this issue May 20, 2022 · 3 comments
Open

raise_error matcher truncates application backtrace #153

dleavitt opened this issue May 20, 2022 · 3 comments
Labels

Comments

@dleavitt
Copy link

In addition to the backtrace for the failing assertion, RSpec's raise_error matcher shows a backtrace for the error site in the application code.

It appears that SuperDiff swallows this trace.

Example

let's say you've got an assertion that looks like this:

expect { subject.execute }.not_to raise_error

where execute maybe calls out to other methods in your application.

Here's what you see in vanilla RSpec when the assertion fails:

Screen Shot 2022-05-19 at 19 42 24

vs. SuperDiff:

Screen Shot 2022-05-19 at 19 44 23

Environment

  • super_diff 0.9.0
  • rspec 3.11.0
  • rails 7.0
  • ruby 3.1
@mcmire
Copy link
Collaborator

mcmire commented May 20, 2022

Ah, that's interesting, the ^^^^^^^ is even in the error message itself. Is this is a new thing in Ruby 3.1? I haven't seen this before. Regardless this does seem like a bug. It's possible RSpec is doing something extra to show that second (first) backtrace and super_diff is not recreating it. I'll take a look when I get a chance!

@mcmire mcmire self-assigned this May 20, 2022
@dleavitt
Copy link
Author

Thanks for the quick response! I didn't to much diligence beyond "here's what it looks like on my computer" so happy to dig a little deeper and get back to you.

@mcmire
Copy link
Collaborator

mcmire commented May 23, 2022

Ah yeah, that would be much appreciated! Some pointers: super_diff does a fair bit of monkey patching to RSpec and the current error handling code is located here. The corresponding RSpec code is here. It's very possible that there is something in the RSpec code that I accidentally overrode. It's also possible there is something else in the rspec-core gem that is responsible for error handling that I haven't included.

@mcmire mcmire removed their assignment Feb 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants