-
-
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
XUnit Reporter Writes to stdout, falls back to console.log #2005
Conversation
Fixes mochajs#1674; provides support *much* needed for [mocha-phantomjs](https://github.com/nathanboktae/mocha-phantomjs) (see [mochajs#133](nathanboktae/mocha-phantomjs#133), [mochajs#220](nathanboktae/mocha-phantomjs#220), etc). Maintains support for running the XUnit reporter in a browser (unlike the previously reverted PR mochajs#1068). ping @alemangui, @nathanboktae Thanks all.
@@ -109,6 +109,8 @@ XUnit.prototype.done = function(failures, fn) { | |||
XUnit.prototype.write = function(line) { | |||
if (this.fileStream) { | |||
this.fileStream.write(line + '\n'); | |||
} else if (typeof process === 'object' && typeof process.stdout === 'object') { |
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.
This would be better written as:
} else if (typeof process === 'object' && process.stdout) {
Comment aside, LGTM. Ideally, reporters wouldn't invoke console.log directly anyway, but instead be passed a writable stream to use. |
Updated based on feedback; merging this would be joy to |
XUnit Reporter Writes to stdout, falls back to console.log
👍 🎅 Thanks! |
Yes this would be great and solve alot of magic done by plugins like |
Fixes #1674; provides support much needed for mocha-phantomjs (see #133, #220, etc). Maintains support for running the XUnit reporter in a browser (unlike the previously reverted PR #1068).
ping @alemangui, @nathanboktae
Thanks all.