Suites still run their children even if none are executable
- Continue skipping beforeAll and afterAll Fixes #707
This commit is contained in:
@@ -2044,13 +2044,12 @@ getJasmineRequireObj().Suite = function() {
|
|||||||
|
|
||||||
var allFns = [];
|
var allFns = [];
|
||||||
|
|
||||||
|
for (var i = 0; i < this.children.length; i++) {
|
||||||
|
allFns.push(wrapChildAsAsync(this.children[i]));
|
||||||
|
}
|
||||||
|
|
||||||
if (this.isExecutable()) {
|
if (this.isExecutable()) {
|
||||||
allFns = allFns.concat(this.beforeAllFns);
|
allFns = this.beforeAllFns.concat(allFns);
|
||||||
|
|
||||||
for (var i = 0; i < this.children.length; i++) {
|
|
||||||
allFns.push(wrapChildAsAsync(this.children[i]));
|
|
||||||
}
|
|
||||||
|
|
||||||
allFns = allFns.concat(this.afterAllFns);
|
allFns = allFns.concat(this.afterAllFns);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ describe("Suite", function() {
|
|||||||
expect(afterAllFn.fn).toHaveBeenCalled();
|
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(),
|
var env = new j$.Env(),
|
||||||
fakeQueueRunnerForParent = jasmine.createSpy('fake parent queue runner'),
|
fakeQueueRunnerForParent = jasmine.createSpy('fake parent queue runner'),
|
||||||
fakeQueueRunnerForChild = jasmine.createSpy('fake child queue runner'),
|
fakeQueueRunnerForChild = jasmine.createSpy('fake child queue runner'),
|
||||||
@@ -209,7 +209,9 @@ describe("Suite", function() {
|
|||||||
parentSuite.afterAll(afterAllFn);
|
parentSuite.afterAll(afterAllFn);
|
||||||
|
|
||||||
parentSuite.execute();
|
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() {
|
it("calls a provided onStart callback when starting", function() {
|
||||||
|
|||||||
@@ -1101,8 +1101,10 @@ describe("Env integration", function() {
|
|||||||
|
|
||||||
reporter.jasmineDone.and.callFake(function() {
|
reporter.jasmineDone.and.callFake(function() {
|
||||||
expect(reporter.jasmineStarted).toHaveBeenCalledWith({
|
expect(reporter.jasmineStarted).toHaveBeenCalledWith({
|
||||||
totalSpecsDefined: 3
|
totalSpecsDefined: 5
|
||||||
});
|
});
|
||||||
|
|
||||||
|
expect(reporter.specDone.calls.count()).toBe(5);
|
||||||
var suiteResult = reporter.suiteStarted.calls.argsFor(1)[0];
|
var suiteResult = reporter.suiteStarted.calls.argsFor(1)[0];
|
||||||
expect(suiteResult.description).toEqual("A Suite");
|
expect(suiteResult.description).toEqual("A Suite");
|
||||||
|
|
||||||
@@ -1123,6 +1125,13 @@ describe("Env integration", function() {
|
|||||||
env.expect(true).toBe(false);
|
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();
|
env.execute();
|
||||||
|
|||||||
+5
-6
@@ -89,13 +89,12 @@ getJasmineRequireObj().Suite = function() {
|
|||||||
|
|
||||||
var allFns = [];
|
var allFns = [];
|
||||||
|
|
||||||
|
for (var i = 0; i < this.children.length; i++) {
|
||||||
|
allFns.push(wrapChildAsAsync(this.children[i]));
|
||||||
|
}
|
||||||
|
|
||||||
if (this.isExecutable()) {
|
if (this.isExecutable()) {
|
||||||
allFns = allFns.concat(this.beforeAllFns);
|
allFns = this.beforeAllFns.concat(allFns);
|
||||||
|
|
||||||
for (var i = 0; i < this.children.length; i++) {
|
|
||||||
allFns.push(wrapChildAsAsync(this.children[i]));
|
|
||||||
}
|
|
||||||
|
|
||||||
allFns = allFns.concat(this.afterAllFns);
|
allFns = allFns.concat(this.afterAllFns);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user