Jasmine should recover gracefully when there are errors in describe functions.
This commit is contained in:
13
src/Env.js
13
src/Env.js
@@ -96,10 +96,21 @@ jasmine.Env.prototype.describe = function(description, specDefinitions) {
|
||||
|
||||
this.currentSuite = suite;
|
||||
|
||||
specDefinitions.call(suite);
|
||||
var declarationError = null;
|
||||
try {
|
||||
specDefinitions.call(suite);
|
||||
} catch(e) {
|
||||
declarationError = e;
|
||||
}
|
||||
|
||||
this.currentSuite = parentSuite;
|
||||
|
||||
if (declarationError) {
|
||||
this.it("encountered a declaration exception", function() {
|
||||
throw declarationError;
|
||||
});
|
||||
}
|
||||
|
||||
return suite;
|
||||
};
|
||||
|
||||
|
||||
@@ -57,6 +57,10 @@ jasmine.MessageResult = function(text) {
|
||||
this.trace = new Error(); // todo: test better
|
||||
};
|
||||
|
||||
jasmine.MessageResult.prototype.toString = function() {
|
||||
return this.text;
|
||||
};
|
||||
|
||||
jasmine.ExpectationResult = function(params) {
|
||||
this.type = 'ExpectationResult';
|
||||
this.matcherName = params.matcherName;
|
||||
@@ -71,6 +75,10 @@ jasmine.ExpectationResult = function(params) {
|
||||
this.trace = this.passed_ ? '' : new Error(this.message);
|
||||
};
|
||||
|
||||
jasmine.ExpectationResult.prototype.toString = function () {
|
||||
return this.message;
|
||||
};
|
||||
|
||||
jasmine.ExpectationResult.prototype.passed = function () {
|
||||
return this.passed_;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user