Skip to content

Commit

Permalink
feat(fancy): look like jest traces
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Nov 19, 2018
1 parent 8748c81 commit ecae238
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/reporters/fancy.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,14 @@ export default class FancyReporter extends BasicReporter {
}

formatStack (stack) {
const color1 = chalkColor('grey')
const color2 = chalkColor('cyan')
const color3 = chalkColor('reset')
const grey = chalkColor('grey')
const cyan = chalkColor('cyan')

return '\n' + parseStack(stack)
.map(line => color2(' ' + line
.replace(/^at /, m => color1(m))
.replace(/\(.*\)/, (m) => color3(m))
))
.map(line => ' ' + line
.replace(/^at +/, m => grey(m))
.replace(/\((.+)\)/, (_, m) => `(${cyan(m)})`)
)
.join('\n')
}

Expand Down

0 comments on commit ecae238

Please sign in to comment.