2022-11-08 22:29:58 -05:00
|
|
|
import chalk from 'chalk'
|
|
|
|
|
2022-12-30 13:52:05 -05:00
|
|
|
const percentage = (dividend, divisor) => (dividend / divisor * 100).toFixed(0)
|
|
|
|
|
2022-11-08 22:29:58 -05:00
|
|
|
const totalreporter = () => {
|
2022-12-30 13:42:42 -05:00
|
|
|
let success = 0, fail = 0, skip = 0
|
2022-11-08 22:29:58 -05:00
|
|
|
|
|
|
|
return {
|
2022-12-30 13:34:35 -05:00
|
|
|
success: (test) => { success++ },
|
|
|
|
fail: (test, e) => { fail++ },
|
2022-12-30 13:42:42 -05:00
|
|
|
skip: (test) => { skip++ },
|
2022-12-30 13:54:11 -05:00
|
|
|
msg: () => `${chalk.redBright(`Fail: ${fail}`)} - ${chalk.greenBright(`Sucess: ${success}`)} - ${chalk.blueBright(`Skip: ${skip}`)} - ${chalk.yellowBright(`Ratio: ${percentage(success, success + fail)}%`)}`
|
2022-11-08 22:29:58 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export { totalreporter }
|