metaltest/totalreporter.js

17 lines
426 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}%`)}
`
}
}
export { totalreporter }