Skip to content

Commit

Permalink
docs: explain config.onComplete execution
Browse files Browse the repository at this point in the history
  • Loading branch information
AriPerkkio committed Jan 3, 2021
1 parent 81f4e76 commit 376c7d5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/progress-logger/progress-logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,13 @@ class ProgressLogger {
const notifyListeners = () =>
this.listeners.exit.forEach(listener => listener());

// Default promise to use if config.onComplete is not defined, or it
// is a synchronous method.
let exitPromise = Promise.resolve();

// Execute possible onComplete before notifying exit-listeners.
// It's essential to not crash whole application if user provided
// onComplete callback throws error. Log the error and move on.
if (config.onComplete) {
const results = ResultsStore.getResults();
try {
Expand Down

0 comments on commit 376c7d5

Please sign in to comment.