From e7b4906dff42ae0d2ca0c4a84577cc9f2c4f1b56 Mon Sep 17 00:00:00 2001 From: Justin Beckwith Date: Sat, 16 Feb 2019 18:34:13 -0800 Subject: [PATCH] fix: print the stats even after a fail --- src/cli.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/cli.ts b/src/cli.ts index 5272f7fe..26aab2cd 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -77,13 +77,17 @@ async function main() { const result = await checker.check(opts); console.log(); + const total = (Date.now() - start) / 1000; + if (!result.passed) { const borked = result.links.filter(x => x.state === LinkState.BROKEN); - console.error(chalk.bold( - `${chalk.red('ERROR')} - detected ${borked.length} broken links.`)); + console.error(chalk.bold(`${chalk.red('ERROR')}: Detected ${ + borked.length} broken links. Scanned ${ + chalk.yellow(result.links.length.toString())} links in ${ + chalk.cyan(total.toString())} seconds.`)); process.exit(1); } - const total = (Date.now() - start) / 1000; + console.log(chalk.bold(`🤖 Successfully scanned ${ chalk.green(result.links.length.toString())} links in ${ chalk.cyan(total.toString())} seconds.`));