* Prints the stats of a test run to the console. * @param {number} passed * @param {number} failed * @param {number} skipped * @param {number|string} duration * @param {number} [failedHooks]
(passed, failed, skipped, duration, failedHooks = 0)
| 279 | * @param {number} [failedHooks] |
| 280 | */ |
| 281 | result(passed, failed, skipped, duration, failedHooks = 0) { |
| 282 | let style = colors.bgGreen |
| 283 | let msg = ` ${passed || 0} passed` |
| 284 | let status = style.bold(' OK ') |
| 285 | if (failed) { |
| 286 | style = style.bgRed |
| 287 | status = style.bold(' FAIL ') |
| 288 | msg += `, ${failed} failed` |
| 289 | } |
| 290 | |
| 291 | if (failedHooks > 0) { |
| 292 | style = style.bgRed |
| 293 | status = style.bold(' FAIL ') |
| 294 | msg += `, ${failedHooks} failedHooks` |
| 295 | } |
| 296 | status += style.grey(' |') |
| 297 | |
| 298 | if (skipped) { |
| 299 | if (!failed) style = style.bgYellow |
| 300 | msg += `, ${skipped} skipped` |
| 301 | } |
| 302 | msg += ' ' |
| 303 | print(status + style(msg) + colors.grey(` // ${duration}`)) |
| 304 | }, |
| 305 | } |
| 306 | |
| 307 | export default output |