diff --git a/lib/jasmine-core/jasmine.js b/lib/jasmine-core/jasmine.js index 1fa20e37..2d4f32e8 100644 --- a/lib/jasmine-core/jasmine.js +++ b/lib/jasmine-core/jasmine.js @@ -564,6 +564,7 @@ getJasmineRequireObj().Env = function(j$) { options.catchException = catchException; options.clearStack = options.clearStack || clearStack; options.timer = {setTimeout: realSetTimeout, clearTimeout: realClearTimeout}; + options.fail = self.fail; new j$.QueueRunner(options).execute(); }; @@ -744,7 +745,6 @@ getJasmineRequireObj().Env = function(j$) { userContext: function() { return suite.clonedSharedUserContext(); }, queueableFn: { fn: fn, - type: 'it', timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; } } }); @@ -801,7 +801,6 @@ getJasmineRequireObj().Env = function(j$) { this.beforeEach = function(beforeEachFunction, timeout) { currentDeclarationSuite.beforeEach({ fn: beforeEachFunction, - type: 'beforeEach', timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; } }); }; @@ -809,7 +808,6 @@ getJasmineRequireObj().Env = function(j$) { this.beforeAll = function(beforeAllFunction, timeout) { currentDeclarationSuite.beforeAll({ fn: beforeAllFunction, - type: 'beforeAll', timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; } }); }; @@ -817,7 +815,6 @@ getJasmineRequireObj().Env = function(j$) { this.afterEach = function(afterEachFunction, timeout) { currentDeclarationSuite.afterEach({ fn: afterEachFunction, - type: 'afterEach', timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; } }); }; @@ -825,7 +822,6 @@ getJasmineRequireObj().Env = function(j$) { this.afterAll = function(afterAllFunction, timeout) { currentDeclarationSuite.afterAll({ fn: afterAllFunction, - type: 'afterAll', timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; } }); }; @@ -890,7 +886,7 @@ getJasmineRequireObj().JsApiReporter = function() { suites_hash = {}; this.suiteStarted = function(result) { - storeSuite(result); + suites_hash[result.id] = result; }; this.suiteDone = function(result) { @@ -1728,6 +1724,7 @@ getJasmineRequireObj().QueueRunner = function(j$) { this.catchException = attrs.catchException || function() { return true; }; this.userContext = attrs.userContext || {}; this.timer = attrs.timeout || {setTimeout: setTimeout, clearTimeout: clearTimeout}; + this.fail = attrs.fail || function() {}; } QueueRunner.prototype.execute = function() { @@ -1773,6 +1770,11 @@ getJasmineRequireObj().QueueRunner = function(j$) { }), timeoutId; + next.fail = function() { + self.fail.apply(null, arguments); + next(); + }; + if (queueableFn.timeout) { timeoutId = Function.prototype.apply.apply(self.timer.setTimeout, [j$.getGlobal(), [function() { var error = new Error('Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.'); diff --git a/spec/core/JsApiReporterSpec.js b/spec/core/JsApiReporterSpec.js index f41667c1..3c382a04 100644 --- a/spec/core/JsApiReporterSpec.js +++ b/spec/core/JsApiReporterSpec.js @@ -182,6 +182,9 @@ describe("JsApiReporter", function() { var reporter, suiteResult1, suiteResult2; beforeEach(function() { reporter = new j$.JsApiReporter({}); + suiteStarted1 = { + id: 1 + }; suiteResult1 = { id: 1, status: 'failed', @@ -192,10 +195,15 @@ describe("JsApiReporter", function() { status: 'finished' }; + reporter.suiteStarted(suiteStarted1); reporter.suiteDone(suiteResult1); reporter.suiteDone(suiteResult2); }); + it('should not include suite starts', function(){ + expect(reporter.suiteResults(0,3).length).toEqual(2); + }); + it("should return a slice of results", function() { expect(reporter.suiteResults(0, 1)).toEqual([suiteResult1]); expect(reporter.suiteResults(1, 1)).toEqual([suiteResult2]); diff --git a/src/core/JsApiReporter.js b/src/core/JsApiReporter.js index 72da146f..2d089429 100644 --- a/src/core/JsApiReporter.js +++ b/src/core/JsApiReporter.js @@ -34,7 +34,7 @@ getJasmineRequireObj().JsApiReporter = function() { suites_hash = {}; this.suiteStarted = function(result) { - storeSuite(result); + suites_hash[result.id] = result; }; this.suiteDone = function(result) {