Skip to content

Commit

Permalink
handle errors for multiple envs running in worker threads
Browse files Browse the repository at this point in the history
  • Loading branch information
gravityvi committed Jul 25, 2023
1 parent 8eb4bd4 commit 3a31fff
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/runner/concurrency/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,14 @@ class Concurrency extends EventEmitter {
});
});

return Promise.all(workerPool.tasks);
return new Promise((resolve, reject) => {
Promise.allSettled(workerPool.tasks)
.then(values => {
values.some(({status}) => status === 'rejected') ? reject() : resolve();
});
});
}

/**
*
* @param {Array} modules
Expand Down

0 comments on commit 3a31fff

Please sign in to comment.