Move afterAll reporting into Suite since that's where they're being tracked

This commit is contained in:
slackersoft
2014-08-27 08:13:17 -07:00
parent 97867b2bf5
commit f8bccabf03
3 changed files with 16 additions and 16 deletions
+7 -4
View File
@@ -173,9 +173,6 @@ getJasmineRequireObj().Env = function(j$) {
reporter.afterAllEvent('Error thrown: '+ (e.message || e.description)); reporter.afterAllEvent('Error thrown: '+ (e.message || e.description));
} }
}; };
options.reportExpectationFailure = function(message) {
reporter.afterAllEvent('Expectation failed: '+ message);
};
new j$.QueueRunner(options).execute(); new j$.QueueRunner(options).execute();
}; };
@@ -185,7 +182,10 @@ getJasmineRequireObj().Env = function(j$) {
id: getNextSuiteId(), id: getNextSuiteId(),
description: 'Jasmine__TopLevel__Suite', description: 'Jasmine__TopLevel__Suite',
queueRunner: queueRunnerFactory, queueRunner: queueRunnerFactory,
resultCallback: function() {} // TODO - hook this up resultCallback: function() {}, // TODO - hook this up
reportExpectationFailure: function(message) {
reporter.afterAllEvent('Expectation failed: '+ message);
}
}); });
runnableLookupTable[topSuite.id] = topSuite; runnableLookupTable[topSuite.id] = topSuite;
defaultResourcesForRunnable(topSuite.id); defaultResourcesForRunnable(topSuite.id);
@@ -241,6 +241,9 @@ getJasmineRequireObj().Env = function(j$) {
currentlyExecutingSuites.pop(); currentlyExecutingSuites.pop();
} }
reporter.suiteDone(attrs); reporter.suiteDone(attrs);
},
reportExpectationFailure: function(message) {
reporter.afterAllEvent('Expectation failed: '+ message);
} }
}); });
-10
View File
@@ -19,8 +19,6 @@ getJasmineRequireObj().QueueRunner = function(j$) {
this.userContext = attrs.userContext || {}; this.userContext = attrs.userContext || {};
this.timer = attrs.timeout || {setTimeout: setTimeout, clearTimeout: clearTimeout}; this.timer = attrs.timeout || {setTimeout: setTimeout, clearTimeout: clearTimeout};
this.reportException = attrs.reportException || function() {}; this.reportException = attrs.reportException || function() {};
this.reportExpectationFailure = attrs.reportExpectationFailure || function() {};
this.afterAllExpectationFailures = attrs.afterAllExpectationFailures || [];
} }
QueueRunner.prototype.execute = function() { QueueRunner.prototype.execute = function() {
@@ -39,7 +37,6 @@ getJasmineRequireObj().QueueRunner = function(j$) {
return attemptAsync(queueableFn); return attemptAsync(queueableFn);
} else { } else {
attemptSync(queueableFn); attemptSync(queueableFn);
flushAfterAllExpectationFailures();
} }
} }
@@ -63,7 +60,6 @@ getJasmineRequireObj().QueueRunner = function(j$) {
}, },
next = once(function () { next = once(function () {
clearTimeout(timeoutId); clearTimeout(timeoutId);
flushAfterAllExpectationFailures();
self.run(queueableFns, iterativeIndex + 1); self.run(queueableFns, iterativeIndex + 1);
}), }),
timeoutId; timeoutId;
@@ -97,12 +93,6 @@ getJasmineRequireObj().QueueRunner = function(j$) {
throw e; throw e;
} }
} }
function flushAfterAllExpectationFailures() {
while (self.afterAllExpectationFailures.length) {
self.reportExpectationFailure(self.afterAllExpectationFailures.pop());
}
}
}; };
return QueueRunner; return QueueRunner;
+9 -2
View File
@@ -8,6 +8,7 @@ getJasmineRequireObj().Suite = function() {
this.resultCallback = attrs.resultCallback || function() {}; this.resultCallback = attrs.resultCallback || function() {};
this.clearStack = attrs.clearStack || function(fn) {fn();}; this.clearStack = attrs.clearStack || function(fn) {fn();};
this.expectationFactory = attrs.expectationFactory; this.expectationFactory = attrs.expectationFactory;
this.reportExpectationFailure = attrs.reportExpectationFailure || function() {};
this.beforeFns = []; this.beforeFns = [];
this.afterFns = []; this.afterFns = [];
@@ -90,11 +91,11 @@ getJasmineRequireObj().Suite = function() {
queueableFns: allFns, queueableFns: allFns,
onComplete: complete, onComplete: complete,
userContext: this.sharedUserContext(), userContext: this.sharedUserContext(),
onException: function() { self.onException.apply(self, arguments); }, onException: function() { self.onException.apply(self, arguments); }
afterAllExpectationFailures: this.afterAllExpectationFailures
}); });
function complete() { function complete() {
self.reportAfterAllExpectationFailures();
self.resultCallback(self.result); self.resultCallback(self.result);
if (onComplete) { if (onComplete) {
@@ -107,6 +108,12 @@ getJasmineRequireObj().Suite = function() {
} }
}; };
Suite.prototype.reportAfterAllExpectationFailures = function() {
while (this.afterAllExpectationFailures.length) {
this.reportExpectationFailure(this.afterAllExpectationFailures.pop());
}
};
Suite.prototype.isExecutable = function() { Suite.prototype.isExecutable = function() {
var foundActive = false; var foundActive = false;
for(var i = 0; i < this.children.length; i++) { for(var i = 0; i < this.children.length; i++) {