Skip to content

Commit

Permalink
changes for jest-community#20
Browse files Browse the repository at this point in the history
Signed-off-by: Charlike Mike Reagent <opensource@tunnckocore.com>
  • Loading branch information
tunnckoCore committed Sep 17, 2019
1 parent 079141b commit bdaf944
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions lib/createJestRunner.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,18 @@ const createRunner = (runPath, { getExtraOptions } = {}) => {
const runAllTests = Promise.all(
tests.map(test =>
runTestInWorker(test)
.then(testResult => onResult(test, testResult))
.catch(error => onError(error, test)),
.then(testResult => {
if (Array.isArray(testResult)) {
testResult.forEach(result =>
result.errorMessage && result.stats.failures > 0
? onError(new Error(result.errorMessage), test)
: onResult(test, result),
);
return;
}
onResult(test, testResult);
})
.catch(err => onError(err, test)),
),
);

Expand Down

0 comments on commit bdaf944

Please sign in to comment.