allow adding a deprecation object
This commit is contained in:
@@ -200,11 +200,11 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
handlingLoadErrors = false;
|
handlingLoadErrors = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.deprecated = function(msg) {
|
this.deprecated = function(deprecation) {
|
||||||
var runnable = currentRunnable() || topSuite;
|
var runnable = currentRunnable() || topSuite;
|
||||||
runnable.addDeprecationWarning(msg);
|
runnable.addDeprecationWarning(deprecation);
|
||||||
if(typeof console !== 'undefined' && typeof console.warn !== 'undefined') {
|
if(typeof console !== 'undefined' && typeof console.error === 'function') {
|
||||||
console.error('DEPRECATION: ' + msg);
|
console.error('DEPRECATION:', deprecation);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -45,10 +45,14 @@ getJasmineRequireObj().buildExpectationResult = function() {
|
|||||||
|
|
||||||
var error = options.error;
|
var error = options.error;
|
||||||
if (!error) {
|
if (!error) {
|
||||||
try {
|
if (options.stack) {
|
||||||
throw new Error(message());
|
error = options;
|
||||||
} catch (e) {
|
} else {
|
||||||
error = e;
|
try {
|
||||||
|
throw new Error(message());
|
||||||
|
} catch (e) {
|
||||||
|
error = e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return stackFormatter(error);
|
return stackFormatter(error);
|
||||||
|
|||||||
@@ -152,8 +152,11 @@ getJasmineRequireObj().Spec = function(j$) {
|
|||||||
return this.getSpecName(this);
|
return this.getSpecName(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
Spec.prototype.addDeprecationWarning = function(msg) {
|
Spec.prototype.addDeprecationWarning = function(deprecation) {
|
||||||
this.result.deprecationWarnings.push(this.expectationResultFactory({ message: msg }));
|
if (typeof deprecation === 'string') {
|
||||||
|
deprecation = { message: deprecation };
|
||||||
|
}
|
||||||
|
this.result.deprecationWarnings.push(this.expectationResultFactory(deprecation));
|
||||||
};
|
};
|
||||||
|
|
||||||
var extractCustomPendingMessage = function(e) {
|
var extractCustomPendingMessage = function(e) {
|
||||||
|
|||||||
@@ -148,8 +148,11 @@ getJasmineRequireObj().Suite = function(j$) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Suite.prototype.addDeprecationWarning = function(msg) {
|
Suite.prototype.addDeprecationWarning = function(deprecation) {
|
||||||
this.result.deprecationWarnings.push(this.expectationResultFactory({ message: msg }));
|
if (typeof deprecation === 'string') {
|
||||||
|
deprecation = { message: deprecation };
|
||||||
|
}
|
||||||
|
this.result.deprecationWarnings.push(this.expectationResultFactory(deprecation));
|
||||||
};
|
};
|
||||||
|
|
||||||
function isFailure(args) {
|
function isFailure(args) {
|
||||||
|
|||||||
Reference in New Issue
Block a user