Refactor Suite#addExpectationResult to use named arguments
This commit is contained in:
@@ -10742,25 +10742,28 @@ getJasmineRequireObj().Suite = function(j$) {
|
|||||||
this.onLateError(new Error(msg));
|
this.onLateError(new Error(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
addExpectationResult() {
|
addExpectationResult(passed, data) {
|
||||||
if (isFailure(arguments)) {
|
if (passed) {
|
||||||
const data = arguments[1];
|
// Passed expectations are accepted for compatibility with
|
||||||
const expectationResult = j$.buildExpectationResult(data);
|
// Spec#addExpectationResult, but aren't recorded.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.reportedDone) {
|
const expectationResult = j$.buildExpectationResult(data);
|
||||||
this.onLateError(expectationResult);
|
|
||||||
} else {
|
|
||||||
this.result.failedExpectations.push(expectationResult);
|
|
||||||
|
|
||||||
// TODO: refactor so that we don't need to override cached status
|
if (this.reportedDone) {
|
||||||
if (this.result.status) {
|
this.onLateError(expectationResult);
|
||||||
this.result.status = 'failed';
|
} else {
|
||||||
}
|
this.result.failedExpectations.push(expectationResult);
|
||||||
|
|
||||||
|
// TODO: refactor so that we don't need to override cached status
|
||||||
|
if (this.result.status) {
|
||||||
|
this.result.status = 'failed';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (this.#throwOnExpectationFailure) {
|
if (this.#throwOnExpectationFailure) {
|
||||||
throw new j$.errors.ExpectationFailed();
|
throw new j$.errors.ExpectationFailed();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -10857,10 +10860,6 @@ getJasmineRequireObj().Suite = function(j$) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function isFailure(args) {
|
|
||||||
return !args[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
return Suite;
|
return Suite;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -220,25 +220,28 @@ getJasmineRequireObj().Suite = function(j$) {
|
|||||||
this.onLateError(new Error(msg));
|
this.onLateError(new Error(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
addExpectationResult() {
|
addExpectationResult(passed, data) {
|
||||||
if (isFailure(arguments)) {
|
if (passed) {
|
||||||
const data = arguments[1];
|
// Passed expectations are accepted for compatibility with
|
||||||
const expectationResult = j$.buildExpectationResult(data);
|
// Spec#addExpectationResult, but aren't recorded.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.reportedDone) {
|
const expectationResult = j$.buildExpectationResult(data);
|
||||||
this.onLateError(expectationResult);
|
|
||||||
} else {
|
|
||||||
this.result.failedExpectations.push(expectationResult);
|
|
||||||
|
|
||||||
// TODO: refactor so that we don't need to override cached status
|
if (this.reportedDone) {
|
||||||
if (this.result.status) {
|
this.onLateError(expectationResult);
|
||||||
this.result.status = 'failed';
|
} else {
|
||||||
}
|
this.result.failedExpectations.push(expectationResult);
|
||||||
|
|
||||||
|
// TODO: refactor so that we don't need to override cached status
|
||||||
|
if (this.result.status) {
|
||||||
|
this.result.status = 'failed';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (this.#throwOnExpectationFailure) {
|
if (this.#throwOnExpectationFailure) {
|
||||||
throw new j$.errors.ExpectationFailed();
|
throw new j$.errors.ExpectationFailed();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -335,9 +338,5 @@ getJasmineRequireObj().Suite = function(j$) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function isFailure(args) {
|
|
||||||
return !args[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
return Suite;
|
return Suite;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user