Send unfocused tests through the same queue as focused tests

This commit is contained in:
Jonathan
2017-07-23 09:01:15 -07:00
parent 4cce7263c4
commit 7dfc5f506c
2 changed files with 19 additions and 13 deletions

View File

@@ -141,7 +141,8 @@ describe("Spec", function() {
});
it("can be disabled, but still calls callbacks", function() {
var fakeQueueRunner = jasmine.createSpy('fakeQueueRunner'),
var fakeQueueRunner = jasmine.createSpy('fakeQueueRunner')
.and.callFake(function(attrs) { attrs.onComplete(); }),
startCallback = jasmine.createSpy('startCallback'),
specBody = jasmine.createSpy('specBody'),
resultCallback = jasmine.createSpy('resultCallback'),
@@ -158,7 +159,7 @@ describe("Spec", function() {
spec.execute();
expect(fakeQueueRunner).not.toHaveBeenCalled();
expect(fakeQueueRunner).toHaveBeenCalled();
expect(specBody).not.toHaveBeenCalled();
expect(startCallback).toHaveBeenCalled();
@@ -166,7 +167,8 @@ describe("Spec", function() {
});
it("can be disabled at execution time by a parent", function() {
var fakeQueueRunner = jasmine.createSpy('fakeQueueRunner'),
var fakeQueueRunner = jasmine.createSpy('fakeQueueRunner')
.and.callFake(function(attrs) { attrs.onComplete(); }),
startCallback = jasmine.createSpy('startCallback'),
specBody = jasmine.createSpy('specBody'),
resultCallback = jasmine.createSpy('resultCallback'),
@@ -181,7 +183,7 @@ describe("Spec", function() {
expect(spec.result.status).toBe('disabled');
expect(fakeQueueRunner).not.toHaveBeenCalled();
expect(fakeQueueRunner).toHaveBeenCalled();
expect(specBody).not.toHaveBeenCalled();
expect(startCallback).toHaveBeenCalled();
@@ -189,7 +191,8 @@ describe("Spec", function() {
});
it("can be marked pending, but still calls callbacks when executed", function() {
var fakeQueueRunner = jasmine.createSpy('fakeQueueRunner'),
var fakeQueueRunner = jasmine.createSpy('fakeQueueRunner')
.and.callFake(function(attrs) { attrs.onComplete(); }),
startCallback = jasmine.createSpy('startCallback'),
resultCallback = jasmine.createSpy('resultCallback'),
spec = new jasmineUnderTest.Spec({
@@ -209,7 +212,7 @@ describe("Spec", function() {
spec.execute();
expect(fakeQueueRunner).not.toHaveBeenCalled();
expect(fakeQueueRunner).toHaveBeenCalled();
expect(startCallback).toHaveBeenCalled();
expect(resultCallback).toHaveBeenCalledWith({

View File

@@ -50,22 +50,25 @@ getJasmineRequireObj().Spec = function(j$) {
this.onStart(this);
if (!this.isExecutable() || this.markedPending || enabled === false) {
complete(enabled);
return;
}
var fns = this.beforeAndAfterFns();
var regularFns = fns.befores.concat(this.queueableFn);
this.queueRunnerFactory({
var runnerConfig = {
isLeaf: true,
queueableFns: regularFns,
cleanupFns: fns.afters,
onException: function() { self.onException.apply(self, arguments); },
onComplete: complete,
userContext: this.userContext()
});
};
if (!this.isExecutable() || this.markedPending || enabled === false) {
runnerConfig.queueableFns = [];
runnerConfig.cleanupFns = [];
runnerConfig.onComplete = function() { complete(enabled); };
}
this.queueRunnerFactory(runnerConfig);
function complete(enabledAgain) {
self.result.status = self.status(enabledAgain);