From ec81e36993a0fdb8d2e24318ed3a3932475fe268 Mon Sep 17 00:00:00 2001 From: Aaron McCall Date: Mon, 18 Apr 2016 11:38:23 -0600 Subject: [PATCH] formatters: buffer.toString for debug output --- lib/formatters/default.js | 2 +- lib/formatters/json.js | 2 +- lib/formatters/summary.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/formatters/default.js b/lib/formatters/default.js index 7f9d46d..4bf7a6f 100644 --- a/lib/formatters/default.js +++ b/lib/formatters/default.js @@ -9,7 +9,7 @@ module.exports = function (err, data) { if (err) { if (data) { - returnString += Chalk.red('(+) ') + 'Debug output: ' + JSON.stringify(data) + '\n'; + returnString += Chalk.red('(+) ') + 'Debug output: ' + JSON.stringify(Buffer.isBuffer(data) ? data.toString() : data) + '\n'; } return returnString + Chalk.yellow('(+) ') + err; diff --git a/lib/formatters/json.js b/lib/formatters/json.js index fd52b99..7920f18 100644 --- a/lib/formatters/json.js +++ b/lib/formatters/json.js @@ -3,7 +3,7 @@ module.exports = function (err, data) { if (err) { - return 'Debug output: ' + JSON.stringify(data) + '\n' + JSON.stringify(err); + return 'Debug output: ' + JSON.stringify(Buffer.isBuffer(data) ? data.toString() : data) + '\n' + JSON.stringify(err); } return JSON.stringify(data, null, 2); diff --git a/lib/formatters/summary.js b/lib/formatters/summary.js index a6a68c5..b835a0d 100644 --- a/lib/formatters/summary.js +++ b/lib/formatters/summary.js @@ -9,7 +9,7 @@ module.exports = function (err, data) { if (err) { if (data) { - returnString += Chalk.red('(+) ') + 'Debug output: ' + JSON.stringify(data) + '\n'; + returnString += Chalk.red('(+) ') + 'Debug output: ' + JSON.stringify(Buffer.isBuffer(data) ? data.toString() : data) + '\n'; } return returnString + Chalk.yellow('(+) ') + err;