Skip to content

armgit / mocha

Public Imported from GitHub
0

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

xunit reporter should use process.stdout.write instead of console.log

Nathan Blackd3cc2181ecdd
diff --git a/lib/reporters/xunit.js b/lib/reporters/xunit.js
index e956380d..e2175433 100644
--- a/lib/reporters/xunit.js
+++ b/lib/reporters/xunit.js
@@ -49,7 +49,7 @@ function XUnit(runner) {
});
runner.on('end', function(){
- console.log(tag('testsuite', {
+ process.stdout.write(tag('testsuite', {
name: 'Mocha Tests'
, tests: stats.tests
, failures: stats.failures
@@ -60,7 +60,7 @@ function XUnit(runner) {
}, false));
tests.forEach(test);
- console.log('</testsuite>');
+ process.stdout.write('</testsuite>');
});
}
@@ -84,11 +84,11 @@ function test(test) {
if ('failed' == test.state) {
var err = test.err;
attrs.message = escape(err.message);
- console.log(tag('testcase', attrs, false, tag('failure', attrs, false, cdata(err.stack))));
+ process.stdout.write(tag('testcase', attrs, false, tag('failure', attrs, false, cdata(err.stack))));
} else if (test.pending) {
- console.log(tag('testcase', attrs, false, tag('skipped', {}, true)));
+ process.stdout.write(tag('testcase', attrs, false, tag('skipped', {}, true)));
} else {
- console.log(tag('testcase', attrs, true) );
+ process.stdout.write(tag('testcase', attrs, true) );
}
}