diff --git a/lib/jasmine-core/jasmine.js b/lib/jasmine-core/jasmine.js index 7da2cc3f..5cc1c519 100644 --- a/lib/jasmine-core/jasmine.js +++ b/lib/jasmine-core/jasmine.js @@ -2044,13 +2044,12 @@ getJasmineRequireObj().Suite = function() { var allFns = []; + for (var i = 0; i < this.children.length; i++) { + allFns.push(wrapChildAsAsync(this.children[i])); + } + if (this.isExecutable()) { - allFns = allFns.concat(this.beforeAllFns); - - for (var i = 0; i < this.children.length; i++) { - allFns.push(wrapChildAsAsync(this.children[i])); - } - + allFns = this.beforeAllFns.concat(allFns); allFns = allFns.concat(this.afterAllFns); } diff --git a/spec/core/SuiteSpec.js b/spec/core/SuiteSpec.js index c84afb8e..761f77eb 100644 --- a/spec/core/SuiteSpec.js +++ b/spec/core/SuiteSpec.js @@ -186,7 +186,7 @@ describe("Suite", function() { expect(afterAllFn.fn).toHaveBeenCalled(); }); - it("does not run beforeAll or afterAll if there are no child specs to run", function() { + it("does not run beforeAll or afterAll if there are no executable child specs", function() { var env = new j$.Env(), fakeQueueRunnerForParent = jasmine.createSpy('fake parent queue runner'), fakeQueueRunnerForChild = jasmine.createSpy('fake child queue runner'), @@ -209,7 +209,9 @@ describe("Suite", function() { parentSuite.afterAll(afterAllFn); parentSuite.execute(); - expect(fakeQueueRunnerForParent).toHaveBeenCalledWith(jasmine.objectContaining({queueableFns: []})); + expect(fakeQueueRunnerForParent).toHaveBeenCalledWith(jasmine.objectContaining({ + queueableFns: [{ fn: jasmine.any(Function) }] + })); }); it("calls a provided onStart callback when starting", function() { diff --git a/spec/core/integration/EnvSpec.js b/spec/core/integration/EnvSpec.js index 56df2290..d2ef352f 100644 --- a/spec/core/integration/EnvSpec.js +++ b/spec/core/integration/EnvSpec.js @@ -1101,8 +1101,10 @@ describe("Env integration", function() { reporter.jasmineDone.and.callFake(function() { expect(reporter.jasmineStarted).toHaveBeenCalledWith({ - totalSpecsDefined: 3 + totalSpecsDefined: 5 }); + + expect(reporter.specDone.calls.count()).toBe(5); var suiteResult = reporter.suiteStarted.calls.argsFor(1)[0]; expect(suiteResult.description).toEqual("A Suite"); @@ -1123,6 +1125,13 @@ describe("Env integration", function() { env.expect(true).toBe(false); }); }); + + env.describe('with only pending specs', function() { + env.it('is pending'); + env.xit('is pending', function() { + env.expect(true).toBe(true); + }); + }); }); env.execute(); diff --git a/src/core/Suite.js b/src/core/Suite.js index 99e81d8f..bafde9ed 100644 --- a/src/core/Suite.js +++ b/src/core/Suite.js @@ -89,13 +89,12 @@ getJasmineRequireObj().Suite = function() { var allFns = []; + for (var i = 0; i < this.children.length; i++) { + allFns.push(wrapChildAsAsync(this.children[i])); + } + if (this.isExecutable()) { - allFns = allFns.concat(this.beforeAllFns); - - for (var i = 0; i < this.children.length; i++) { - allFns.push(wrapChildAsAsync(this.children[i])); - } - + allFns = this.beforeAllFns.concat(allFns); allFns = allFns.concat(this.afterAllFns); }