Suites report errors in afterAlls in the suiteDone event

- remove `afterAllEvent` from reporters
This commit is contained in:
slackersoft
2014-09-03 18:52:13 -07:00
parent 6b857d11ce
commit 9402d59859
14 changed files with 306 additions and 203 deletions

View File

@@ -98,12 +98,10 @@ describe("QueueRunner", function() {
beforeFn = { fn: function(done) { }, type: 'before', timeout: function() { return timeout; } },
queueableFn = { fn: jasmine.createSpy('fn'), type: 'queueable' },
onComplete = jasmine.createSpy('onComplete'),
reportException = jasmine.createSpy('reportException'),
onException = jasmine.createSpy('onException'),
queueRunner = new j$.QueueRunner({
queueableFns: [beforeFn, queueableFn],
onComplete: onComplete,
reportException: reportException,
onException: onException
});
@@ -112,7 +110,6 @@ describe("QueueRunner", function() {
jasmine.clock().tick(timeout);
expect(reportException).toHaveBeenCalledWith(jasmine.any(Error), 'before');
expect(onException).toHaveBeenCalledWith(jasmine.any(Error));
expect(queueableFn.fn).toHaveBeenCalled();
expect(onComplete).toHaveBeenCalled();
@@ -122,12 +119,10 @@ describe("QueueRunner", function() {
var beforeFn = { fn: function(done) { } },
queueableFn = { fn: jasmine.createSpy('fn') },
onComplete = jasmine.createSpy('onComplete'),
reportException = jasmine.createSpy('reportException'),
onException = jasmine.createSpy('onException'),
queueRunner = new j$.QueueRunner({
queueableFns: [beforeFn, queueableFn],
onComplete: onComplete,
reportException: reportException,
onException: onException,
});
@@ -136,7 +131,6 @@ describe("QueueRunner", function() {
jasmine.clock().tick(j$.DEFAULT_TIMEOUT_INTERVAL);
expect(reportException).not.toHaveBeenCalled();
expect(onException).not.toHaveBeenCalled();
expect(queueableFn.fn).not.toHaveBeenCalled();
expect(onComplete).not.toHaveBeenCalled();
@@ -145,35 +139,29 @@ describe("QueueRunner", function() {
it("clears the timeout when an async function throws an exception, to prevent additional exception reporting", function() {
var queueableFn = { fn: function(done) { throw new Error("error!"); } },
onComplete = jasmine.createSpy('onComplete'),
reportException = jasmine.createSpy('reportException'),
onException = jasmine.createSpy('onException'),
queueRunner = new j$.QueueRunner({
queueableFns: [queueableFn],
onComplete: onComplete,
reportException: reportException,
onException: onException
});
queueRunner.execute();
expect(onComplete).toHaveBeenCalled();
expect(reportException).toHaveBeenCalled();
expect(onException).toHaveBeenCalled();
jasmine.clock().tick(j$.DEFAULT_TIMEOUT_INTERVAL);
expect(reportException.calls.count()).toEqual(1);
expect(onException.calls.count()).toEqual(1);
});
it("clears the timeout when the done callback is called", function() {
var queueableFn = { fn: function(done) { done(); } },
onComplete = jasmine.createSpy('onComplete'),
reportException = jasmine.createSpy('reportException'),
onException = jasmine.createSpy('onException'),
queueRunner = new j$.QueueRunner({
queueableFns: [queueableFn],
onComplete: onComplete,
reportException: reportException,
onException: onException
});
@@ -182,7 +170,6 @@ describe("QueueRunner", function() {
expect(onComplete).toHaveBeenCalled();
jasmine.clock().tick(j$.DEFAULT_TIMEOUT_INTERVAL);
expect(reportException).not.toHaveBeenCalled();
expect(onException).not.toHaveBeenCalled();
});
@@ -218,17 +205,14 @@ describe("QueueRunner", function() {
fn: function() {
throw new Error('fake error');
} },
exceptionCallback = jasmine.createSpy('exception callback'),
onExceptionCallback = jasmine.createSpy('on exception callback'),
queueRunner = new j$.QueueRunner({
queueableFns: [queueableFn],
reportException: exceptionCallback,
onException: onExceptionCallback
});
queueRunner.execute();
expect(exceptionCallback).toHaveBeenCalledWith(jasmine.any(Error), 'queueable');
expect(onExceptionCallback).toHaveBeenCalledWith(jasmine.any(Error));
});