Skip to content

Commit

Permalink
fix: correctly calculate line width when using grave accent
Browse files Browse the repository at this point in the history
  • Loading branch information
pooya parsa committed May 26, 2019
1 parent 07d8246 commit bad52bd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/reporters/fancy.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@ export default class FancyReporter extends BasicReporter {

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

const formattedMessage = message.replace(/`([^`]+)`/g, (_, m) => chalk.cyan(m))

let line
const left = this.filterAndJoin([type, message])
const left = this.filterAndJoin([type, formattedMessage])
const right = this.filterAndJoin([tag, date])
const space = width - stringWidth(left) - stringWidth(right) - 2

Expand All @@ -78,8 +80,6 @@ export default class FancyReporter extends BasicReporter {

line += additional.length ? '\n' + additional.join('\n') : ''

line = line.replace(/`([^`]+)`/g, (_, m) => chalk.cyan(m))

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

0 comments on commit bad52bd

Please sign in to comment.