Protect against a FF bug: Exceptions don't always have a message property even though they were instantiated with one. Using Error#toString alleviates this
This commit is contained in:
@@ -1717,7 +1717,7 @@ jasmine.Spec.prototype.getFullName = function() {
|
|||||||
jasmine.Spec.pendingSpecExceptionMessage = "=> marked Pending";
|
jasmine.Spec.pendingSpecExceptionMessage = "=> marked Pending";
|
||||||
|
|
||||||
jasmine.Spec.isPendingSpecException = function(e) {
|
jasmine.Spec.isPendingSpecException = function(e) {
|
||||||
return e.message.indexOf(jasmine.Spec.pendingSpecExceptionMessage) === 0;
|
return e.toString().indexOf(jasmine.Spec.pendingSpecExceptionMessage) !== -1;
|
||||||
};jasmine.Suite = function(attrs) {
|
};jasmine.Suite = function(attrs) {
|
||||||
this.env = attrs.env;
|
this.env = attrs.env;
|
||||||
this.id = attrs.id;
|
this.id = attrs.id;
|
||||||
|
|||||||
@@ -6,6 +6,13 @@ describe("Spec", function() {
|
|||||||
expect(jasmine.Spec.isPendingSpecException(e)).toBe(true);
|
expect(jasmine.Spec.isPendingSpecException(e)).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("#isPendingSpecException returns true for a pending spec exception (protect against FF bug)", function() {
|
||||||
|
var e = new Error(jasmine.Spec.pendingSpecExceptionMessage);
|
||||||
|
delete e.message;
|
||||||
|
|
||||||
|
expect(jasmine.Spec.isPendingSpecException(e)).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
it("#isPendingSpecException returns true for a pending spec exception", function() {
|
it("#isPendingSpecException returns true for a pending spec exception", function() {
|
||||||
var e = new Error("foo");
|
var e = new Error("foo");
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -114,5 +114,5 @@ jasmine.Spec.prototype.getFullName = function() {
|
|||||||
jasmine.Spec.pendingSpecExceptionMessage = "=> marked Pending";
|
jasmine.Spec.pendingSpecExceptionMessage = "=> marked Pending";
|
||||||
|
|
||||||
jasmine.Spec.isPendingSpecException = function(e) {
|
jasmine.Spec.isPendingSpecException = function(e) {
|
||||||
return e.message.indexOf(jasmine.Spec.pendingSpecExceptionMessage) === 0;
|
return e.toString().indexOf(jasmine.Spec.pendingSpecExceptionMessage) !== -1;
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user