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
Aggregate failures Integration #1946
Conversation
ea6f7fd
to
a0281fe
Compare
module Core | ||
module Formatters | ||
# @private | ||
class ExceptionFormatter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is ExceptionFormatter
a good name for this? It's not a "Formatter" in RSpec's sense (even though it does do formatting), we use the term printer elsewhere for this sort of thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought it was a good name, in spite of the fact that it's not a "Formatter" in the RSpec sense....but ExceptionPrinter
is fine by me if you prefer it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I do just so nobody naively thinks it's a formatter in its own right :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, it is labeled @private
, so it's not really intended to be available or visible to users...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I know, but so are the deprecation and bisect formatters etc and they're real formatters. Thanks for making the change though, ❤️
a0281fe
to
9f1bf1b
Compare
@JonRowe, I renamed the |
Personally I think we should rename |
3bb1b61
to
d0e02ee
Compare
I decided on |
Perfect ❤️ |
5d9eb71
to
7d38d28
Compare
801bd8e
to
aac27c6
Compare
OK, this PR is ready for review as well. It builds on top of rspec/rspec-expectations#733 and integrates that feature. The code changes here provide a couple things:
Note that this PR can't be merged until rspec/rspec-expectations#733 is, and that one has a There's also an open question around what /cc @rspec/rspec (especially @xaviershay) |
@@ -218,6 +218,14 @@ | |||
end | |||
end | |||
|
|||
it 'uses only one thread local variable', :run_last do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
huh, cute.
I'm allowed to define arbitrary metadata, right? So in that case, not being able to "overload" Or actually, we're now defining this as a reserved word in Not really worth a lot of effort though I don't think. |
All this presentation stuff is gnarly. Good cleanups overall. |
Yep, I'm leading towards "do nothing" for now. We can always do something later -- handling this case a bit more gracefully for users who use rspec-core but not rspec-expectations won't be a breaking API change so there's no urgency to get it in now.
Yeah, it kinda fried my brain :(. I still feel like it's really messy but I don't really want to put the effort into further refactorings now unless there's an obvious easy, big win someone has in mind. |
# namespace. | ||
def self.thread_local_metadata | ||
Thread.current[:_rspec] ||= { :shared_example_group_inclusions => [] } | ||
RSpec::Support.thread_local_data[:current_example] = example |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh neat :)
214e86e
to
02824d6
Compare
OK, I think this is ready for a final review (and hopefully a merge!). Since @xaviershay's review, I added a cuke (viewable here), and added some improvements so that nested failure aggregation blocks format well. Want to do a final review, @xaviershay? I do still have to remove the [Temp] commit that pins this to the rspec-expectations branch, of course. I'll do that after we merge that PR. |
ship it! |
This will make it easier to extract an `ExceptionFormatter`.
- Simplifies the notification classes. - Provides something we can use to format multiple expectation failures packaged as a single exception for `aggregate_failures`.
We need to combine some of these cases (such as when we get a `MultipleExpectationsNotMetError` in a pending spec), and to do that we need to combine the options, so having the options listed in the same method is a stepping stone towards that.
To get this to work properly, we have to compose the exception presenter options for pending and for MultipleExpectationsNotMetError.
It is already listed on the aggregate failure backtrace, and would be redundant to list it on each sub-failure.
This should hopefully make the travis build go green...
- The presence of backticks within that part was causing rendering problems on relish. - Different rubies have different output there so we already ignore that part when comparing the expected to actual output.
This is necessary to support nested aggregation blocks.
This is necessary for niche situations where `aggregate_failures` is nested.
a999dc8
to
2d17102
Compare
Aggregate failures Integration
Aggregate failures Integration
[ci skip]
This is the start of the rspec-core work for the new
aggregate_failures
feature. The part I'm working on now is getting the aggregated failure to format how we want. To facilitate this, I've extracted a newExceptionFormatter
class that is able to format exceptions according to how rspec-core typically does it for its built-in formatters. We'll then be able to apply this to each of the aggregated failures.More to come, but I wanted to push what I had and get the travis build going.