From b4361bf18197c23deab6016f909ff64c62a57c40 Mon Sep 17 00:00:00 2001 From: Liam Newman Date: Fri, 13 Dec 2013 13:29:18 -0800 Subject: [PATCH] Hijack process.stdout as well as console.log The latest xunit reporter uses process.stdout instead of console.log. We need to hijack stdout as well as console. --- tasks/mocha.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tasks/mocha.js b/tasks/mocha.js index 552c404..a6ed312 100644 --- a/tasks/mocha.js +++ b/tasks/mocha.js @@ -165,11 +165,15 @@ module.exports = function(grunt) { var dest = this.data.dest; var output = []; var consoleLog = console.log; + // Latest mocha xunit reporter sends to process.stdout instead of console + var processWrite = process.stdout.write; + // Only hijack if we really need to if (dest) { console.log = function() { consoleLog.apply(console, arguments); + processWrite.apply(process.stdout, arguments); output.push(util.format.apply(util, arguments)); }; }