Skip to content

Commit

Permalink
fix: fix badge display
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Oct 8, 2018
1 parent b645c20 commit e036eed
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/reporters/fancy.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,11 @@ export default class FancyReporter extends BasicReporter {
}

// Print type
if (fields.type !== 'log') {
if (logObj.badge) {
this.write(chalkBgColor(logObj.color).black(` ${fields.type.toUpperCase()} `))
} else {
const icon = logObj.icon || ICONS[fields.type] || ICONS.default
this.write(chalkColor(logObj.color)(`${icon} ${fields.type.toUpperCase()} `))
}
if (logObj.badge) {
this.write('\n' + chalkBgColor(logObj.color).black(` ${fields.type.toUpperCase()} `) + ' ')
} else if (fields.type !== 'log') {
const icon = logObj.icon || ICONS[fields.type] || ICONS.default
this.write(chalkColor(logObj.color)(`${icon} ${fields.type.toUpperCase()} `))
}

// Print tag
Expand All @@ -64,6 +62,11 @@ export default class FancyReporter extends BasicReporter {
this.write(fields.message)
}

// Badge additional line
if (logObj.badge) {
this.write('\n')
}

// Print additional args
if (fields.args.length) {
this.write('\n' + chalkColor('grey')(fields.args.join(' ')))
Expand Down

0 comments on commit e036eed

Please sign in to comment.