diff --git a/lib/jasmine-core/jasmine.js b/lib/jasmine-core/jasmine.js index d084a3d9..37c42255 100644 --- a/lib/jasmine-core/jasmine.js +++ b/lib/jasmine-core/jasmine.js @@ -8407,7 +8407,6 @@ getJasmineRequireObj().QueueRunner = function(j$) { // TODO probably shouldn't next() right away here. // That makes debugging async failures much more confusing. onException(error); - next(error); }, cleanup = once(function cleanup() { if (timeoutId !== void 0) { diff --git a/spec/core/QueueRunnerSpec.js b/spec/core/QueueRunnerSpec.js index d0574296..302e535e 100644 --- a/spec/core/QueueRunnerSpec.js +++ b/spec/core/QueueRunnerSpec.js @@ -783,9 +783,13 @@ describe('QueueRunner', function() { jasmine.clock().uninstall(); }); - it('skips to cleanup functions on the first exception', function() { + it('skips to cleanup functions once the fn completes after an unhandled exception', function() { var errorListeners = [], - queueableFn = { fn: function(done) {} }, + queueableFn = { + fn: function(done) { + queueableFnDone = done; + } + }, nextQueueableFn = { fn: jasmine.createSpy('nextFunction') }, cleanupFn = { fn: jasmine.createSpy('cleanup') }, queueRunner = new jasmineUnderTest.QueueRunner({ @@ -800,10 +804,13 @@ describe('QueueRunner', function() { queueableFns: [queueableFn, nextQueueableFn], cleanupFns: [cleanupFn], completeOnFirstError: true - }); + }), + queueableFnDone; queueRunner.execute(); errorListeners[errorListeners.length - 1](new Error('error')); + expect(cleanupFn.fn).not.toHaveBeenCalled(); + queueableFnDone(); expect(nextQueueableFn.fn).not.toHaveBeenCalled(); expect(cleanupFn.fn).toHaveBeenCalled(); }); diff --git a/src/core/QueueRunner.js b/src/core/QueueRunner.js index 29b22660..7b6ebdd2 100644 --- a/src/core/QueueRunner.js +++ b/src/core/QueueRunner.js @@ -106,7 +106,6 @@ getJasmineRequireObj().QueueRunner = function(j$) { // TODO probably shouldn't next() right away here. // That makes debugging async failures much more confusing. onException(error); - next(error); }, cleanup = once(function cleanup() { if (timeoutId !== void 0) {