Skip to content

Commit 34738c7

Browse files
author
pooya parsa
committedFeb 23, 2019
feat(fancy): move right to the left if length is <= 80
1 parent 5821099 commit 34738c7

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed
 

‎src/reporters/fancy.js

+8-6
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,18 @@ export default class FancyReporter extends BasicReporter {
6464

6565
const tag = logObj.tag ? secondaryColor(logObj.tag) : ''
6666

67+
let line
6768
let left = this.filterAndJoin([type, message])
6869
let right = this.filterAndJoin([tag, date])
6970

70-
const space = width - stringWidth(left) - stringWidth(right) - 2
71-
72-
let line = space > 0 ? (left + ' '.repeat(space) + right) : left
71+
if (width > 80) {
72+
const space = width - stringWidth(left) - stringWidth(right) - 2
73+
line = space > 0 ? (left + ' '.repeat(space) + right) : left
74+
} else {
75+
line = right + ' ' + left
76+
}
7377

74-
line += additional.length
75-
? '\n' + additional.join('\n')
76-
: ''
78+
line += additional.length ? '\n' + additional.join('\n') : ''
7779

7880
return isBadge ? '\n' + line + '\n' : line
7981
}

0 commit comments

Comments
 (0)