Extract percent function
parent
9f2890ce32
commit
c91f4a466b
|
@ -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)}%`)}`
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue