Suites still run their children even if none are executable

- Continue skipping beforeAll and afterAll

Fixes #707
This commit is contained in:
slackersoft
2014-11-16 14:43:44 -08:00
parent 25c546a904
commit 23a492cb65
4 changed files with 24 additions and 15 deletions

View File

@@ -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);
}

View File

@@ -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() {

View File

@@ -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();

View File

@@ -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);
}