-
-
Notifications
You must be signed in to change notification settings - Fork 649
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
Register a listener(reporter) that always listens #257
Comments
On reflection, having looked at the Catch2 code more closely, I see that Catch has two separate concepts, Listener and Reporter. Catch2 listeners are registered with Catch2 reporters are selectable by the user at run-time, depending on their needs... If I understand correctly, doctest has combined these two features in to one - hence this question. |
I think it should be doable like this: context.addFilter("reporters", "my-listener");
context.addFilter("reporters", "console");
// and then call
context.applyCommandLine(argc, argv); when providing a custom main. But I'm not sure if that way the console reporter will be replaceable - perhaps the API isn't sufficient yet. Thanks for reporting this - I'll think about it some more when I have the time. |
I just pushed this in the dev branch - just use I also just noticed your note about a skype call - I contacted your colleague on Linkedin about a google hangouts which we will arrange there I guess :) |
Thanks! I read the differences in the docs, and I understand the changes because of this request... I'd be happy to make some minor clarifications to the new docs if you'd be interested - what would be the most convenient way for me to do this? Comments on the commit? |
Or pair? |
Sorry I left the office. Whichever is easiest for you - comments on the review work too :) |
I can confirm that when I build ApprovalTests.cpp against the doctest single header on its dev branch, and change #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
#include <doctest.hpp> This is tremendous - thanks very much indeed. I know you're busy, but do you have any idea when you might do your next release, please? It would be lovely to get this included in ApprovalTests.cpp before I head off for CppCon, to plug the doctest integration as part of my talk there... :-) |
I've also confirmed that the existing reporter mechanism works fine when I have registered a Listener as described above. For example, running our tests with |
As far as I'm concerned, this feature is good to go, and the issue could be closed - thank you again for implementing this! /CC @isidore |
I'll release an official version hopefully within 1-2 weeks - way before CppCon :) |
That’s ideal - thank you! |
Description
Currently, registering a new reporter only works if the program's command-line arguments request the new reporter.
This is great for a reporter, but it doesn't allow for a subscription model.
For ApprovalTests.cpp, we are looking to say
REGISTER_LISTENER(MyReporter)
- that will always listen, and not interfere with any use of--reporter
on the command line.Steps to reproduce
If you call
REGISTER_REPORTER()
without the use of--reporter=
, your listener is not used.Extra information
We (@isidore and I) would love to have a 10 minute Skype call with you, if you are interested.
We are doing this as someone has asked us to make ApprovalTests.cpp support doctest: approvals/ApprovalTests.cpp#11
The text was updated successfully, but these errors were encountered: