metaltest/reporter/totalreporter.js

15 lines
435 B
JavaScript

import chalk from 'chalk'
const totalreporter = () => {
let totalSuccess = 0, totalFail = 0
return {
success: (test) => { totalSuccess++ },
fail: (test, e) => { totalFail++ },
msg: () => `${chalk.redBright(`Total fail: ${totalFail}`)}
${chalk.greenBright(`Total sucess: ${totalSuccess}`)}
${chalk.yellowBright(`Ratio ${(totalSuccess / (totalSuccess + totalFail) * 100).toFixed(0)}%`)}`
}
}
export { totalreporter }