metaltest/reporter/totalreporter.js

19 lines
529 B
JavaScript

import chalk from 'chalk'
const percentage = (dividend, divisor) => (dividend / divisor * 100).toFixed(0)
const totalreporter = () => {
let success = 0, fail = 0, skip = 0
return {
success: (test) => { success++ },
fail: (test, e) => { fail++ },
skip: (test) => { skip++ },
msg: () => `${chalk.redBright(`Fail: ${fail}`)}
${chalk.greenBright(`Sucess: ${success}`)}
${chalk.blueBright(`Skip: ${skip}`)}
${chalk.yellowBright(`Ratio: ${percentage(success, success + fail)}%`)}`
}
}
export { totalreporter }