import chalk from 'chalk' const log = (...args) => process.stdout.write(...args) const errorreporter = () => { const report = { end: (stats) => { const { testFail } = stats for (const test of testFail) { log('\n' + chalk.redBright(test.name) + '\n') prettyError(test.error) } } } return report } import { stackParser } from '../lib/stackparser.js' const prettyError = (error) => { if (typeof error == 'string') { log(chalk.yellowBright(error)) log('\n') return } const stack = stackParser(error.stack) log(chalk.yellowBright(stack.title) + '\n') if (stack.diff != '') log(chalk.white(stack.diff) + '\n') if (stack.where != '') log(chalk.gray(stack.where) + '\n') } export { errorreporter }