Add ability to report deprecation warnings from within the suite

[#154746527]
This commit is contained in:
Gregg Van Hove
2018-02-05 11:19:15 -08:00
parent 70bce55721
commit 5afe1222f4
6 changed files with 101 additions and 4 deletions

View File

@@ -25,6 +25,7 @@ getJasmineRequireObj().Spec = function(j$) {
* @property {String} fullName - The full description including all ancestors of this spec.
* @property {Expectation[]} failedExpectations - The list of expectations that failed during execution of this spec.
* @property {Expectation[]} passedExpectations - The list of expectations that passed during execution of this spec.
* @property {Expectation[]} deprecationWarnings - The list of deprecation warnings that occurred during execution this spec.
* @property {String} pendingReason - If the spec is {@link pending}, this will be the reason.
* @property {String} status - Once the spec has completed, this string represents the pass/fail status of this spec.
*/
@@ -34,6 +35,7 @@ getJasmineRequireObj().Spec = function(j$) {
fullName: this.getFullName(),
failedExpectations: [],
passedExpectations: [],
deprecationWarnings: [],
pendingReason: ''
};
}
@@ -149,6 +151,10 @@ getJasmineRequireObj().Spec = function(j$) {
return this.getSpecName(this);
};
Spec.prototype.addDeprecationWarning = function(msg) {
this.result.deprecationWarnings.push(this.expectationResultFactory({ message: msg }));
};
var extractCustomPendingMessage = function(e) {
var fullMessage = e.toString(),
boilerplateStart = fullMessage.indexOf(Spec.pendingSpecExceptionMessage),