diff --git a/reporter/totalreporter.js b/reporter/totalreporter.js index fd276e5..88277de 100644 --- a/reporter/totalreporter.js +++ b/reporter/totalreporter.js @@ -1,5 +1,7 @@ import chalk from 'chalk' +const percentage = (dividend, divisor) => (dividend / divisor * 100).toFixed(0) + const totalreporter = () => { let success = 0, fail = 0, skip = 0 @@ -10,7 +12,7 @@ const totalreporter = () => { msg: () => `${chalk.redBright(`Fail: ${fail}`)} ${chalk.greenBright(`Sucess: ${success}`)} ${chalk.blueBright(`Skip: ${skip}`)} -${chalk.yellowBright(`Ratio: ${(success / (success + fail) * 100).toFixed(0)}%`)}` +${chalk.yellowBright(`Ratio: ${percentage(success, success + fail)}%`)}` } }