Skip to content
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

Implement support for multiple reporters #1772

Closed
wants to merge 1 commit into from
Closed

Implement support for multiple reporters #1772

wants to merge 1 commit into from

Conversation

benvinegar
Copy link
Contributor

Continuation of #1681, targeted against 2.x (master) instead of 3.x.

Necessary for completion:

Review on Reviewable

function done(failures) {
function runnerDone(failures) {
var remain = reporters.length
, reporterDone = function(failures) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fyi: with the linting work that's being done, we're not going to be using leading commas. also, the below conditional will need curlies

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Roger.

@boneskull
Copy link
Contributor

@benvinegar

support distinct output streams for each reporter (e.g. 'spec' → stdout while 'json' → file)

Is this in-progress or...?

@danielstjules
Copy link
Contributor

@benvinegar Awesome work on this btw :)

Is this in-progress or...?

@boneskull It might be difficult without a writeable stream being passed to each reporter, since they all invoke either process.stdout.write or console.log directly. Ideally, mocha would pass process.stdout to any reporter writing to stdout, and an fs.WriteStream when writing to a file (or just some buffer that gets written at the end of exec). At that point you'd probably end up with something similar to what you mentioned in #1772 (comment)

@benvinegar Did you have an easier solution in mind for getting the distinct output streams working? I've got some cycles this week too if you wanna collaborate.

@atticoos
Copy link

This would be great to have :)

@lostthetrail
Copy link

This is a super useful feature. It appears the development has stalled on it?

@benvinegar
Copy link
Contributor Author

This is stalled. Sorry everyone. Ultimately I was driven on this project because it was important for a project I was working on, but I've since moved on and it's no longer in my sights. The small handful of comments over the past 6 months hasn't really motivated me sufficiently to continue.

@danielstjules – This is a super late reply, but if we could get together to push through on this, I'm game.

Otherwise I can help someone else take over.

@antoinebrault
Copy link

+1 really need this for CI.

@lpinca
Copy link

lpinca commented Dec 23, 2015

I would also love to have this for the same reason mentioned by @antoinebrault.

@boneskull
Copy link
Contributor

Anyway, a prototype of #1969 will have this built in

@machineghost
Copy link

Please, someone finish merging this; having to run your entire suite multiple times just to get xunit and coverage reports is lame.

@boneskull
Copy link
Contributor

@antoinebrault @machineghost @lpinca you may want to take this PR over and see if you can get it finished. my focus is elsewhere atm

@santiagoaguiar
Copy link

@boneskull @benvinegar I'll be integrating the current work on latest and add the missing pieces, any things to keep in mind?

I'm working over master, should I do it on 3.0 instead?

@santiagoaguiar
Copy link

First question: most of the reporters in mocha do a direct process.stdout.write or console.log, but to ensure they can be used while passing --reporter reporter:outputfilename they should instead use the inherited write method from the Base reporter that was added on this PR, which does a process.stdout.write (which, by the way, should probably fallback to console.log for browser environments?). I guess this is what was being discussed on #1772 (comment).

Any reason not to do such change?.

Since this requires updating every reporter, I'm guessing we should do that on an independent PR?.

@benvinegar
Copy link
Contributor Author

See #2184

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants