Skip to content

Commit

Permalink
XUnit Reporter Writes to stdout, falls back to console.log
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jonnyreeves committed Dec 14, 2015
1 parent 3af1b8a commit c66bc83
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/reporters/xunit.js
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
process.stdout.write(line + '\n');
} else {
console.log(line);
}
Expand Down

0 comments on commit c66bc83

Please sign in to comment.