-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Support for multiple reporters #930
Support for multiple reporters #930
Conversation
…ake the same types of arguments as before, plus a list of reporter names as a comma separated string, or a list of constructors. This allows using more than one reporter. - Replaced command line switch --reporter <name> by --reporters <name>,... so that users can pass a comma separated list of reporters on the command line. - The old --reporters command line switch used to list available reporters is now --list-reporters.
… --reporter and --list-reporters is back to --reporters. - Use the "list" arguments parser for --reporter now. - Mocha.reporters does not accept a comma-separated string of reporter names anymore, this is the command line parser's job to parse the --reporter command line switch and provide an array to this function.
Bump, This would be especially useful for the karma js mocha adapter. Currently it reports just results back to karma. I would like the debug view to show tests in progress using the test reporter, and this would allow that fairly simply. |
if (options.growl) this._growl(runner, reporter); | ||
// Use only the first reporter for growl, since we don't want to | ||
// send several notifications for the same tests suite | ||
if (options.growl) this._growl(runner, this._reportersInstances[0]); |
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.
Would probably make sense to have growl as a reporter instead if we have multiple reporter support here.
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.
Excellent idea, thank you! I'll investigate that next week.
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.
@park9140 Sorry I haven't been able to find the time to work on this. Any update on your side about this?
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.
Haven't had a chance to look at it yet. If we could pull the multiple reporter thing in it would be a simple update.
Looks like these changes broke old CLI usage: --reporter option won't work anymore |
@deadproger Did you see this commit: 5f3cbe9 ? If yes, what makes you think it would break --reporter? |
Sorry, I haven't seen :( |
+1 for this |
+1 from me but this should be done after the other issue to place all streams ontop of a streaming json thing, so they all just become consumers, then you could |
@visionmedia Thank you very much for your feedback! Any link to the issue you mentioned about "placing all streams on top of a streaming json thing" would be much appreciated. I searched for it on GitHub but couldn't find it. |
@visionmedia Did you see my previous question? I'd really like to get this feature in. |
@travisjeffery Thank you for the pointer, I had somehow missed it. |
+1 This would be a big bonus for me as well. |
I am using a custom version of Mocha locally that includes this change. Thanks a ton @misterdjules - I hope this gets merged in soon. |
@Quazie Thank you, I'm glad it helps! I'd love to get this feature merged too. As @travisjeffery pointed out, it seems that we need to resolve at least #492 or #897 before being able to work on merging this one. @visionmedia Could you please confirm which issue(s) need(s) to be fixed before being able to merge this one? Also, it would be nice to get an idea of what needs to be done on these dependent issues so that we can make some progress towards merging this pull request. |
Could definitely use this as well. In my case I want to capture code coverage and xunit. |
I've put together a third-party reporter to try and achieve this. I'd appreciate any feedback from people on if this actually works reasonably well. It's a massive hack. |
@glenjamin I'd like to find some time to try it in the near future, I'll let you know If I do. Thanks! |
@glenjamin It works well, except that the process does not exit, even if I use only the "dot" reporter. The fact that it's an external solution (using a reporter) is definitely very interesting, but the code sure looks like it's doing a lot of hacky stuff :) Let me know if I can help you diagnose why it's not exiting properly. |
I created a Google document to try to sum up what's going on with this multiple reporters feature. I think it's a good way to keep track of the various efforts going, their dependencies and what needs to be done to ship this. Any help would be greatly appreciated. |
@misterdjules if you could raise an issue on mocha-multi itself with platform versions and steps to reproduce that'd be great. I'm using a hack similar to --no-exit to ensure stream writing is complete, so if you've got anything keeping the event loop going then that would keep your process running. |
@glenjamin Turns out that fs.watch causes mocha to hangs when using mocha-multi. More info in this issue |
Just to let you know that @glenjamin's mocha-multi works very well, and it works right now. You might have to wait until he publishes the latest version to npm though, otherwise take it directly from master. |
👍 |
👍 |
👍 |
+1 |
1 similar comment
+1 |
@travisjeffery, @misterdjules, whats the holdup here? |
@park9140, @benvinegar picked up the PR, but it's still work in progress. |
I'm basically looking for guidance on what the command line argument format
|
@benvinegar is that the only thing left? |
@dasilvacontin Pretty much. |
@benvinegar Cool! |
What about that? |
I had also considered
|
Is this still moving forward? It's been a month since last comment. |
@TakenPilot, I believe @benvinegar's PR is waiting for him to work on it. At least we managed to decide a format for the arguments. |
Sorry everyone, I found it hard to pick up this PR again after rebasing, trying to finagle conflicts, etc. I'm willing to put in one last hurrah this weekend, but if I don't get anywhere, I should probably pass the torch. |
We'll be here to help @benvinegar, you can contact me on Gitter if needed. :) |
I'm thinking this can be closed in the meantime, in favor of #1360? @travisjeffery @boneskull |
indeedy |
👍 please! :) |
👍 |
2 similar comments
👍 |
👍 |
👍 is the merged yet? I checked out mocha-multi but would be nice as part of core Mocha |
Does anyone know the status of this PR? |
why is this closed? Was this finally merged? |
@corvinrok If you literally read just 10 comments up or so, you will see that it got moved/merged with #1360 |
... Aaaand then I noticed that that got closed too, without any visible traction, and despite multiple people requesting it and proposing various PR's. sigh. |
Hi!
This pull request adds support for multiple reporters.
One of my use cases for multiple reporters is described in my recent post on mocha's google group. To sum it up, I'm using mocha to run tests on a Bamboo instance, and I use the xunit-file reporter to create a file that can be parsed by Bamboo to display tests results. However, I also need to send tests reports to a CouchDB instance that doesn't accept xml files, but JSON documents. Right now, I'm running the tests twice: first with the xunit-file reporter, and then with the mocha-json-file-reporter to generate the xunit file and the json document. This has a number of cons like slowing down the whole process, and even sometimes not generating the exact same results, which can lead to a lot of confusion.
These changes allow me to run both reporters at the same time, and I think being able to run more than one reporter at a time can be useful to others. All the tests seem to run fine.