From 34738c7d1c0e8ac57c98d45696ef757c6c8e248c Mon Sep 17 00:00:00 2001 From: pooya parsa Date: Sat, 23 Feb 2019 21:37:33 +0330 Subject: [PATCH] feat(fancy): move right to the left if length is <= 80 --- src/reporters/fancy.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/reporters/fancy.js b/src/reporters/fancy.js index 2014bbe..4af8fe7 100644 --- a/src/reporters/fancy.js +++ b/src/reporters/fancy.js @@ -64,16 +64,18 @@ export default class FancyReporter extends BasicReporter { const tag = logObj.tag ? secondaryColor(logObj.tag) : '' + let line let left = this.filterAndJoin([type, message]) let right = this.filterAndJoin([tag, date]) - const space = width - stringWidth(left) - stringWidth(right) - 2 - - let line = space > 0 ? (left + ' '.repeat(space) + right) : left + if (width > 80) { + const space = width - stringWidth(left) - stringWidth(right) - 2 + line = space > 0 ? (left + ' '.repeat(space) + right) : left + } else { + line = right + ' ' + left + } - line += additional.length - ? '\n' + additional.join('\n') - : '' + line += additional.length ? '\n' + additional.join('\n') : '' return isBadge ? '\n' + line + '\n' : line }