Jasmine should recover gracefully when there are errors in describe functions.

This commit is contained in:
Christian Williams
2010-06-04 14:14:31 -04:00
parent 803a2fb2ba
commit ed49104fad
3 changed files with 71 additions and 1 deletions

View File

@@ -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;
};