Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

XUnit Reporter Writes to stdout, falls back to console.log

John Reevesc66bc8354bac
diff --git a/lib/reporters/xunit.js b/lib/reporters/xunit.js
index 7c16302c..a61e0bc7 100644
--- a/lib/reporters/xunit.js
+++ b/lib/reporters/xunit.js
@@ -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);
}