rspec / rspec-core

RSpec runner and formatters
http://rspec.info
MIT License
1.23k stars 765 forks source link

Use formatted_backtrace in JSON formatter #2980

Closed mlarraz closed 1 year ago

mlarraz commented 2 years ago

Currently the JSON formatter does not respect the --backtrace flag (it will always print the full backtrace).

I believe this should behave the same as other formatters and respect the config.

pirj commented 2 years ago

Just glanced over. I don't quite get the spec change. Is it indicative that --backtrace will be respected now?

mlarraz commented 2 years ago

Just glanced over. I don't quite get the spec change. Is it indicative that --backtrace will be respected now?

This PR changes the order of the "examples" key in the output. Failures will always be last now since the code is iterating through them after the non-failures.

The spec relied implicitly on the order, so I changed it to instead look for the first failure, and re-arranged the expected output.

If for some reason ordering is really important here, I can try to find a way to make the same change while preserving it.

pirj commented 2 years ago

Ordering is not that important as "respect the --backtrace flag" is. A spec that would assure in this is.

mlarraz commented 1 year ago

I think these failures are unrelated to my changes, as I can reproduce them in a new branch cut directly from main

JonRowe commented 1 year ago

Thank you, I fixed an issue with the build elsewhere to get this green.

JonRowe commented 10 months ago

Released in 3.13.0, apologies it has taken so long.