Skip to content

Commit

Permalink
Build unexpected.js
Browse files Browse the repository at this point in the history
  • Loading branch information
papandreou committed Mar 13, 2016
1 parent 6f454d4 commit 342f9e4
Showing 1 changed file with 10 additions and 18 deletions.
28 changes: 10 additions & 18 deletions unexpected.js
Expand Up @@ -243,26 +243,19 @@ function createExpectIt(expect, expectations) {
});

return oathbreaker(expect.promise.settle(promises).then(function () {
var isSuccessful = groupEvaluations.some(function (groupEvaluation) {
return groupEvaluation.every(function (evaluation) {
return evaluation.promise.isFulfilled();
});
}) && !groupEvaluations.some(function (groupEvaluation) {
// If one of the or groups has a bubbleThrough error as the
// first failing assertion, fail the whole expect.it:
for (var i = 0 ; i < groupEvaluation.length ; i += 1) {
var evaluation = groupEvaluation[i];
if (evaluation.promise.isRejected()) {
if (evaluation.promise.reason().errorMode === 'bubbleThrough') {
return true;
} else {
break;
}
groupEvaluations.forEach(function (groupEvaluation) {
groupEvaluation.forEach(function (evaluation) {
if (evaluation.promise.isRejected() && evaluation.promise.reason().errorMode === 'bubbleThrough') {
throw evaluation.promise.reason();
}
}
});
});

if (!isSuccessful) {
if (!groupEvaluations.some(function (groupEvaluation) {
return groupEvaluation.every(function (evaluation) {
return evaluation.promise.isFulfilled();
});
})) {
expect.fail(function (output) {
writeGroupEvaluationsToOutput(expect, output, groupEvaluations);
});
Expand Down Expand Up @@ -886,7 +879,6 @@ Unexpected.prototype.throwAssertionNotFoundError = function (subject, testDescri
var candidateHandlers = this.assertions[testDescriptionString];
if (candidateHandlers) {
this.fail({
errorMode: 'bubbleThrough',
message: function (output) {
var subjectOutput = function (output) {
output.appendInspected(subject);
Expand Down

0 comments on commit 342f9e4

Please sign in to comment.