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
Proposed changes for the formatter API #944
Comments
Why is the explicit registration better than just checking +1 on data object. |
Tell don't ask.
I don't like that use of inheritance, in strictly my opinion it's no better than requiring a 'Base' class and it's unnecessarily ugly. |
We've run into some problems with this -- see #966. The TL;DR is that |
I'd forgotten about that :) |
Having a null implementation that you build on top of seems a great use of mixins to me, and certainly less complicated then explicit registration, but I guess it's aethestics. |
In my eye's it's not less complicated because you have to be aware of the entire api in case you accidentally override something, and because any formatter that does something is by definition not a null formatter, mixing it in feels wrong... I just don't like the use of inheritance for this sort of thing when all you need to do instead is a one shot method call to tell the reporter what you're listening to. This way we're being explicit. We still intend to allow "legacy" style custom formatters via an adaptor. |
I like the idea of the registration method - potentially it could take an array and/or a hash. reporter.subscribe self,
:start, # sends a message with the same name as the event
:example_started,
example_passed: :example_executed, # event: :message_to_send
example_failed: :example_executed |
I don't want to have a duality there, if we want to support differing names I'd rather have two methods, |
I believe these changes have been implemented. Closing. @JonRowe, reopen if I'm wrong. |
|
The current api for notifying formatters of test suite progress has proved to
be a little inflexible when it comes to adding in new notifications and changing
existing notifications. So we are proposing to change the formatter API in two ways.
Firstly all formatters will be required to tell the reporter which notifications they subscribe to; meaning you can implement the minimum possible to suit your needs.
Secondly all notifications will be a method call with a value object, rather than a string of arguments so that we can change the data passed to notifications without breaking the method signature in future.
So in the future a simple summary formatter might look something like this:
I'm not certain on the registration format I'd like to use, we already do a simplified version of the above by checking what methods formatters respond to and manually registering, but I'd like to open it up and potentially even allow extensions to send their own notifications which formatters can listen for, but wouldn't be a part of the core api. It might also make more sense to do something like this instead:
In order to allow formatters to have their own internal language and to interrogate the reporter rather than just dumbly report what they implement, but I'm set on using a value object for messages rather than an argument list.
Thoughts? Feedback?
The text was updated successfully, but these errors were encountered: