Skip to content

Commit

Permalink
fix: print the stats even after a fail (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBeckwith committed Feb 17, 2019
1 parent 28c52b1 commit a4136aa
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.`));
Expand Down

0 comments on commit a4136aa

Please sign in to comment.