-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(handle-check-failure): extract as separate task (from process)
- Loading branch information
1 parent
2f3d146
commit 1d1aa91
Showing
4 changed files
with
27 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import chalk from 'chalk'; | ||
import { ListrTask } from 'listr2'; | ||
|
||
import { Context } from '../interface'; | ||
|
||
export const handledCheckFailureInfoTask: ListrTask = { | ||
title: 'Handled check failure info', | ||
skip: (ctx: Context) => ctx.control.skipEverySubsequentTask, | ||
task: (ctx: Context, task) => { | ||
if (ctx.handledCheckFailures.length) { | ||
const count = ctx.handledCheckFailures.length; | ||
task.title = `${task.title} - ${count} handled check failure${ | ||
count > 1 ? 's' : '' | ||
} occurred`; | ||
ctx.handledCheckFailures.forEach((error) => { | ||
task.title = `${task.title}\n${chalk.yellow.bold( | ||
`⚠️ ${error.message}` | ||
)}`; | ||
}); | ||
} | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters