beforeAll/afterAll can be timed out and errors are applied to all children specs

This commit is contained in:
Gregg Van Hove and Sheel Choksi
2014-03-03 16:13:59 -08:00
parent e17a2cb1e0
commit 52026fb0f7
8 changed files with 183 additions and 148 deletions

View File

@@ -69,25 +69,22 @@ getJasmineRequireObj().Suite = function() {
var allFns = [];
if (this.isExecutable()) {
for (var b = 0; b < this.beforeAllFns.length; b++) {
allFns.push(this.beforeAllFns[b]);
}
allFns = this.beforeAllFns;
for (var i = 0; i < this.children.length; i++) {
allFns.push(wrapChildAsAsync(this.children[i]));
}
for (var a = 0; a < this.afterAllFns.length; a++) {
allFns.push(this.afterAllFns[a]);
}
allFns = allFns.concat(this.afterAllFns);
}
this.onStart(this);
this.queueRunner({
fns: allFns,
queueableFns: allFns,
onComplete: complete,
userContext: this.sharedUserContext()
userContext: this.sharedUserContext(),
onException: function() { self.onException.apply(self, arguments); }
});
function complete() {
@@ -99,7 +96,7 @@ getJasmineRequireObj().Suite = function() {
}
function wrapChildAsAsync(child) {
return function(done) { child.execute(done); };
return { fn: function(done) { child.execute(done); } };
}
};
@@ -126,6 +123,13 @@ getJasmineRequireObj().Suite = function() {
return clone(this.sharedUserContext());
};
Suite.prototype.onException = function() {
for (var i = 0; i < this.children.length; i++) {
var child = this.children[i];
child.onException.apply(child, arguments);
}
};
function clone(obj) {
var clonedObj = {};
for (var prop in obj) {