metaltest/totalreporter.js

15 lines
435 B
JavaScript
Raw Permalink Normal View History

2022-11-08 22:29:58 -05:00
import chalk from 'chalk'
const totalreporter = () => {
let totalSuccess = 0, totalFail = 0
return {
success: (test) => { totalSuccess++ },
fail: (test, e) => { totalFail++ },
2022-12-04 16:04:31 -05:00
msg: () => `${chalk.redBright(`Total fail: ${totalFail}`)}
2022-11-08 22:29:58 -05:00
${chalk.greenBright(`Total sucess: ${totalSuccess}`)}
2022-12-04 16:04:31 -05:00
${chalk.yellowBright(`Ratio ${(totalSuccess / (totalSuccess + totalFail) * 100).toFixed(0)}%`)}`
2022-11-08 22:29:58 -05:00
}
}
export { totalreporter }