Skip to content

Commit bdaf944

Browse files
committed
changes for #20
Signed-off-by: Charlike Mike Reagent <[email protected]>
1 parent 079141b commit bdaf944

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

lib/createJestRunner.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,18 @@ const createRunner = (runPath, { getExtraOptions } = {}) => {
142142
const runAllTests = Promise.all(
143143
tests.map(test =>
144144
runTestInWorker(test)
145-
.then(testResult => onResult(test, testResult))
146-
.catch(error => onError(error, test)),
145+
.then(testResult => {
146+
if (Array.isArray(testResult)) {
147+
testResult.forEach(result =>
148+
result.errorMessage && result.stats.failures > 0
149+
? onError(new Error(result.errorMessage), test)
150+
: onResult(test, result),
151+
);
152+
return;
153+
}
154+
onResult(test, testResult);
155+
})
156+
.catch(err => onError(err, test)),
147157
),
148158
);
149159

0 commit comments

Comments
 (0)