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
Formatter regression tests prep for merge #1309
Conversation
This is necessary for the Fuubar formatter, among others.
The act of adding a legacy formatter triggered a deprecation warning which called `setup_defaults`, which added the progress formatter because we hadn't stored the formatter in `@formatters` yet. By moving the deprecation until after we store the formatter in `@formatters`, it avoids this problem.
c284ecd was because I had a circular require issue... autoloading prevented that |
…or-merge Formatter regression tests prep for merge
Looked good to me, I'm ok with the extra hack not being shipped in beta2, although I'd prefer it were, as I think a similar approach is going to be needed in the gem and I'd like earlier feedback... |
Actually, I just thought of an alternate approach that I think is far simpler and will work better that would be fairly easy to do in the gem: have the gem redefine each of the built-in formatters and base classes with the definition of those classes from 2.99. This is very easy to reason about (if a subclassing custom formatter is subclassing a class that's identically defined, it should work with no additional monkey business needed). There are two slight downsides to this approach:
|
As it stands they'll break when redefined. |
Maybe I'm misunderstanding something, but with how I'm imagining this to work (but perhaps have explained poorly), they shouldn't. I'm thinking the gem will redefine the built-in formatters as well, because some custom formatters subclass a non-base class formatter (such as |
We'll have to go and undefine them as compatible formatters, as it stands RSpec will see one of our formatters and attempt to use them as a 3.x version, except they'll be a 2.x version, and will break. |
Sure, that make sense. I hadn't considered it. So yeah, there are some details to work out but what do you think of the idea as a whole? |
I'm fine with it, but we need a big disclaimer telling people that's what's happening, so they don't expect / attempt to use newer features when the gem's in use. |
I recommend adding the formatters from parallel_tests to the suite. I found an issue with a formatter I'm working on. I won't recommend my formatter for the suite, because it's very non-standard and WIP, but I think parallel_tests is broken for a similar reason. I found that my formatter didn't work with a deep inheritance structure, but if I modified to extend directly from If you add them to the suite, it works properly with rspec2, but with rspec3 it fails because:
|
@maxlinc we're taking steps to allow as many legacy formatters to work as possible, but there will be cases that don't work, especially those that don't do standard patterns of implementation, it may be that |
I do think that the legacy formatter support will be much more reliable in the extracted legacy formatter support gem, because being a separate code base that is only loaded if the user is using legacy formatters allows us to use solutions that wouldn't be viable directly in rspec-core (such as redefining the rspec-core base classes to be exactly as they were in 2.14 -- the main problem is the change in base classes, not the change in formatter API -- we have a legacy adapter that translates quite well to address that issue). |
This is meant to supersede #1304 and #1292.
@wip
.Even though this doesn't solve all problems with legacy formatters, it's ready to merge and, IMO, it's sufficient for beta2. As @JonRowe and I discussed in #1304, we plan to move the legacy formatter support into an external gem and the work can continue there. What is here is merely a start but contains no complicated hacks.
/cc @JonRowe