@@ -4913,7 +4913,7 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.errored = result.errored;
|
self.errored = self.errored || result.errored;
|
||||||
|
|
||||||
if (this.completeOnFirstError && result.errored) {
|
if (this.completeOnFirstError && result.errored) {
|
||||||
this.skipToCleanup(iterativeIndex);
|
this.skipToCleanup(iterativeIndex);
|
||||||
@@ -6265,8 +6265,11 @@ getJasmineRequireObj().TreeProcessor = function() {
|
|||||||
|
|
||||||
queueRunnerFactory({
|
queueRunnerFactory({
|
||||||
onComplete: function () {
|
onComplete: function () {
|
||||||
|
var args = Array.prototype.slice.call(arguments, [0]);
|
||||||
node.cleanupBeforeAfter();
|
node.cleanupBeforeAfter();
|
||||||
nodeComplete(node, node.getResult(), done);
|
nodeComplete(node, node.getResult(), function() {
|
||||||
|
done.apply(undefined, args);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
queueableFns: [onStart].concat(wrapChildren(node, segmentNumber)),
|
queueableFns: [onStart].concat(wrapChildren(node, segmentNumber)),
|
||||||
userContext: node.sharedUserContext(),
|
userContext: node.sharedUserContext(),
|
||||||
|
|||||||
@@ -481,15 +481,18 @@ describe("QueueRunner", function() {
|
|||||||
var queueableFn = { fn: function() { throw new Error("error"); } },
|
var queueableFn = { fn: function() { throw new Error("error"); } },
|
||||||
nextQueueableFn = { fn: jasmine.createSpy("nextFunction") },
|
nextQueueableFn = { fn: jasmine.createSpy("nextFunction") },
|
||||||
cleanupFn = { fn: jasmine.createSpy("cleanup") },
|
cleanupFn = { fn: jasmine.createSpy("cleanup") },
|
||||||
|
onComplete = jasmine.createSpy("onComplete"),
|
||||||
queueRunner = new jasmineUnderTest.QueueRunner({
|
queueRunner = new jasmineUnderTest.QueueRunner({
|
||||||
queueableFns: [queueableFn, nextQueueableFn],
|
queueableFns: [queueableFn, nextQueueableFn],
|
||||||
cleanupFns: [cleanupFn],
|
cleanupFns: [cleanupFn],
|
||||||
|
onComplete: onComplete,
|
||||||
completeOnFirstError: true
|
completeOnFirstError: true
|
||||||
});
|
});
|
||||||
|
|
||||||
queueRunner.execute();
|
queueRunner.execute();
|
||||||
expect(nextQueueableFn.fn).not.toHaveBeenCalled();
|
expect(nextQueueableFn.fn).not.toHaveBeenCalled();
|
||||||
expect(cleanupFn.fn).toHaveBeenCalled();
|
expect(cleanupFn.fn).toHaveBeenCalled();
|
||||||
|
expect(onComplete).toHaveBeenCalledWith(jasmine.any(jasmineUnderTest.StopExecutionError));
|
||||||
});
|
});
|
||||||
|
|
||||||
it("does not skip when a cleanup function throws", function() {
|
it("does not skip when a cleanup function throws", function() {
|
||||||
|
|||||||
@@ -297,7 +297,7 @@ describe("TreeProcessor", function() {
|
|||||||
node.getResult.and.returnValue({ my: 'result' });
|
node.getResult.and.returnValue({ my: 'result' });
|
||||||
|
|
||||||
queueRunner.calls.mostRecent().args[0].onComplete();
|
queueRunner.calls.mostRecent().args[0].onComplete();
|
||||||
expect(nodeComplete).toHaveBeenCalledWith(node, { my: 'result' }, nodeDone);
|
expect(nodeComplete).toHaveBeenCalledWith(node, { my: 'result' }, jasmine.any(Function));
|
||||||
});
|
});
|
||||||
|
|
||||||
it("runs a node with children", function() {
|
it("runs a node with children", function() {
|
||||||
@@ -328,6 +328,37 @@ describe("TreeProcessor", function() {
|
|||||||
expect(leaf2.execute).toHaveBeenCalledWith('bar', false);
|
expect(leaf2.execute).toHaveBeenCalledWith('bar', false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("cascades errors up the tree", function() {
|
||||||
|
var leaf = new Leaf(),
|
||||||
|
node = new Node({ children: [leaf] }),
|
||||||
|
root = new Node({ children: [node] }),
|
||||||
|
queueRunner = jasmine.createSpy('queueRunner'),
|
||||||
|
nodeComplete = jasmine.createSpy('nodeComplete'),
|
||||||
|
processor = new jasmineUnderTest.TreeProcessor({
|
||||||
|
tree: root,
|
||||||
|
runnableIds: [node.id],
|
||||||
|
nodeComplete: nodeComplete,
|
||||||
|
queueRunnerFactory: queueRunner
|
||||||
|
}),
|
||||||
|
treeComplete = jasmine.createSpy('treeComplete'),
|
||||||
|
nodeDone = jasmine.createSpy('nodeDone');
|
||||||
|
|
||||||
|
processor.execute(treeComplete);
|
||||||
|
var queueableFns = queueRunner.calls.mostRecent().args[0].queueableFns;
|
||||||
|
queueableFns[0].fn(nodeDone);
|
||||||
|
|
||||||
|
queueableFns = queueRunner.calls.mostRecent().args[0].queueableFns;
|
||||||
|
expect(queueableFns.length).toBe(2);
|
||||||
|
|
||||||
|
queueableFns[1].fn('foo');
|
||||||
|
expect(leaf.execute).toHaveBeenCalledWith('foo', false);
|
||||||
|
|
||||||
|
queueRunner.calls.mostRecent().args[0].onComplete('things');
|
||||||
|
expect(nodeComplete).toHaveBeenCalled();
|
||||||
|
nodeComplete.calls.mostRecent().args[2]();
|
||||||
|
expect(nodeDone).toHaveBeenCalledWith('things');
|
||||||
|
});
|
||||||
|
|
||||||
it("runs an excluded node with leaf", function() {
|
it("runs an excluded node with leaf", function() {
|
||||||
var leaf1 = new Leaf(),
|
var leaf1 = new Leaf(),
|
||||||
node = new Node({ children: [leaf1] }),
|
node = new Node({ children: [leaf1] }),
|
||||||
@@ -361,7 +392,7 @@ describe("TreeProcessor", function() {
|
|||||||
node.getResult.and.returnValue({ im: 'disabled' });
|
node.getResult.and.returnValue({ im: 'disabled' });
|
||||||
|
|
||||||
queueRunner.calls.mostRecent().args[0].onComplete();
|
queueRunner.calls.mostRecent().args[0].onComplete();
|
||||||
expect(nodeComplete).toHaveBeenCalledWith(node, { im: 'disabled' }, nodeDone);
|
expect(nodeComplete).toHaveBeenCalledWith(node, { im: 'disabled' }, jasmine.any(Function));
|
||||||
});
|
});
|
||||||
|
|
||||||
it("runs beforeAlls for a node with children", function() {
|
it("runs beforeAlls for a node with children", function() {
|
||||||
|
|||||||
@@ -952,13 +952,17 @@ describe("spec running", function () {
|
|||||||
it("does not run further specs when one fails", function(done) {
|
it("does not run further specs when one fails", function(done) {
|
||||||
var actions = [];
|
var actions = [];
|
||||||
|
|
||||||
env.it('fails', function() {
|
env.describe('wrapper', function() {
|
||||||
actions.push('fails');
|
env.it('fails', function() {
|
||||||
env.expect(1).toBe(2);
|
actions.push('fails');
|
||||||
|
env.expect(1).toBe(2);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
env.it('does not run', function() {
|
env.describe('holder', function() {
|
||||||
actions.push('does not run');
|
env.it('does not run', function() {
|
||||||
|
actions.push('does not run');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
env.randomizeTests(false);
|
env.randomizeTests(false);
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.errored = result.errored;
|
self.errored = self.errored || result.errored;
|
||||||
|
|
||||||
if (this.completeOnFirstError && result.errored) {
|
if (this.completeOnFirstError && result.errored) {
|
||||||
this.skipToCleanup(iterativeIndex);
|
this.skipToCleanup(iterativeIndex);
|
||||||
|
|||||||
@@ -174,8 +174,11 @@ getJasmineRequireObj().TreeProcessor = function() {
|
|||||||
|
|
||||||
queueRunnerFactory({
|
queueRunnerFactory({
|
||||||
onComplete: function () {
|
onComplete: function () {
|
||||||
|
var args = Array.prototype.slice.call(arguments, [0]);
|
||||||
node.cleanupBeforeAfter();
|
node.cleanupBeforeAfter();
|
||||||
nodeComplete(node, node.getResult(), done);
|
nodeComplete(node, node.getResult(), function() {
|
||||||
|
done.apply(undefined, args);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
queueableFns: [onStart].concat(wrapChildren(node, segmentNumber)),
|
queueableFns: [onStart].concat(wrapChildren(node, segmentNumber)),
|
||||||
userContext: node.sharedUserContext(),
|
userContext: node.sharedUserContext(),
|
||||||
|
|||||||
Reference in New Issue
Block a user