Rename queueRunnerFactory to runQueue throughout
This commit is contained in:
@@ -842,7 +842,7 @@ getJasmineRequireObj().Spec = function(j$) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Spec.prototype.execute = function(
|
Spec.prototype.execute = function(
|
||||||
queueRunnerFactory,
|
runQueue,
|
||||||
globalErrors,
|
globalErrors,
|
||||||
onComplete,
|
onComplete,
|
||||||
excluded,
|
excluded,
|
||||||
@@ -925,7 +925,7 @@ getJasmineRequireObj().Spec = function(j$) {
|
|||||||
}
|
}
|
||||||
runnerConfig.queueableFns.push(complete);
|
runnerConfig.queueableFns.push(complete);
|
||||||
|
|
||||||
queueRunnerFactory(runnerConfig);
|
runQueue(runnerConfig);
|
||||||
};
|
};
|
||||||
|
|
||||||
Spec.prototype.reset = function() {
|
Spec.prototype.reset = function() {
|
||||||
@@ -1651,7 +1651,7 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
deprecator.addDeprecationWarning(runable, deprecation, options);
|
deprecator.addDeprecationWarning(runable, deprecation, options);
|
||||||
};
|
};
|
||||||
|
|
||||||
function queueRunnerFactory(options) {
|
function runQueue(options) {
|
||||||
options.clearStack = options.clearStack || clearStack;
|
options.clearStack = options.clearStack || clearStack;
|
||||||
options.timeout = {
|
options.timeout = {
|
||||||
setTimeout: realSetTimeout,
|
setTimeout: realSetTimeout,
|
||||||
@@ -1675,7 +1675,7 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
onLateError: recordLateError,
|
onLateError: recordLateError,
|
||||||
specResultCallback,
|
specResultCallback,
|
||||||
specStarted,
|
specStarted,
|
||||||
queueRunnerFactory
|
runQueue
|
||||||
});
|
});
|
||||||
topSuite = suiteBuilder.topSuite;
|
topSuite = suiteBuilder.topSuite;
|
||||||
const deprecator = new j$.Deprecator(topSuite);
|
const deprecator = new j$.Deprecator(topSuite);
|
||||||
@@ -1702,7 +1702,7 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
j$.reporterEvents,
|
j$.reporterEvents,
|
||||||
function(options) {
|
function(options) {
|
||||||
options.SkipPolicy = j$.NeverSkipPolicy;
|
options.SkipPolicy = j$.NeverSkipPolicy;
|
||||||
return queueRunnerFactory(options);
|
return runQueue(options);
|
||||||
},
|
},
|
||||||
recordLateError
|
recordLateError
|
||||||
);
|
);
|
||||||
@@ -1713,7 +1713,7 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
focusedRunables: () => suiteBuilder.focusedRunables,
|
focusedRunables: () => suiteBuilder.focusedRunables,
|
||||||
runableResources,
|
runableResources,
|
||||||
reporter,
|
reporter,
|
||||||
queueRunnerFactory,
|
runQueue,
|
||||||
TreeProcessor: j$.TreeProcessor,
|
TreeProcessor: j$.TreeProcessor,
|
||||||
globalErrors,
|
globalErrors,
|
||||||
getConfig: () => config,
|
getConfig: () => config,
|
||||||
@@ -8555,7 +8555,7 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
|||||||
getJasmineRequireObj().ReportDispatcher = function(j$) {
|
getJasmineRequireObj().ReportDispatcher = function(j$) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
function ReportDispatcher(methods, queueRunnerFactory, onLateError) {
|
function ReportDispatcher(methods, runQueue, onLateError) {
|
||||||
const dispatchedMethods = methods || [];
|
const dispatchedMethods = methods || [];
|
||||||
|
|
||||||
for (const method of dispatchedMethods) {
|
for (const method of dispatchedMethods) {
|
||||||
@@ -8593,7 +8593,7 @@ getJasmineRequireObj().ReportDispatcher = function(j$) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return new Promise(function(resolve) {
|
return new Promise(function(resolve) {
|
||||||
queueRunnerFactory({
|
runQueue({
|
||||||
queueableFns: fns,
|
queueableFns: fns,
|
||||||
onComplete: resolve,
|
onComplete: resolve,
|
||||||
isReporter: true,
|
isReporter: true,
|
||||||
@@ -9407,7 +9407,7 @@ getJasmineRequireObj().Runner = function(j$) {
|
|||||||
this.totalSpecsDefined_ = options.totalSpecsDefined;
|
this.totalSpecsDefined_ = options.totalSpecsDefined;
|
||||||
this.focusedRunables_ = options.focusedRunables;
|
this.focusedRunables_ = options.focusedRunables;
|
||||||
this.runableResources_ = options.runableResources;
|
this.runableResources_ = options.runableResources;
|
||||||
this.queueRunnerFactory_ = options.queueRunnerFactory;
|
this.runQueue_ = options.runQueue;
|
||||||
this.TreeProcessor_ = options.TreeProcessor;
|
this.TreeProcessor_ = options.TreeProcessor;
|
||||||
this.globalErrors_ = options.globalErrors;
|
this.globalErrors_ = options.globalErrors;
|
||||||
this.reporter_ = options.reporter;
|
this.reporter_ = options.reporter;
|
||||||
@@ -9460,7 +9460,7 @@ getJasmineRequireObj().Runner = function(j$) {
|
|||||||
const processor = new this.TreeProcessor_({
|
const processor = new this.TreeProcessor_({
|
||||||
tree: this.topSuite_,
|
tree: this.topSuite_,
|
||||||
runnableIds: runablesToRun,
|
runnableIds: runablesToRun,
|
||||||
queueRunnerFactory: options => {
|
runQueue: options => {
|
||||||
if (options.isLeaf) {
|
if (options.isLeaf) {
|
||||||
// A spec
|
// A spec
|
||||||
options.SkipPolicy = j$.CompleteOnFirstErrorSkipPolicy;
|
options.SkipPolicy = j$.CompleteOnFirstErrorSkipPolicy;
|
||||||
@@ -9473,7 +9473,7 @@ getJasmineRequireObj().Runner = function(j$) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.queueRunnerFactory_(options);
|
return this.runQueue_(options);
|
||||||
},
|
},
|
||||||
globalErrors: this.globalErrors_,
|
globalErrors: this.globalErrors_,
|
||||||
failSpecWithNoExpectations: config.failSpecWithNoExpectations,
|
failSpecWithNoExpectations: config.failSpecWithNoExpectations,
|
||||||
@@ -11297,7 +11297,7 @@ getJasmineRequireObj().TreeProcessor = function() {
|
|||||||
function TreeProcessor(attrs) {
|
function TreeProcessor(attrs) {
|
||||||
const tree = attrs.tree;
|
const tree = attrs.tree;
|
||||||
const runnableIds = attrs.runnableIds;
|
const runnableIds = attrs.runnableIds;
|
||||||
const queueRunnerFactory = attrs.queueRunnerFactory;
|
const runQueue = attrs.runQueue;
|
||||||
const nodeStart = attrs.nodeStart || function() {};
|
const nodeStart = attrs.nodeStart || function() {};
|
||||||
const nodeComplete = attrs.nodeComplete || function() {};
|
const nodeComplete = attrs.nodeComplete || function() {};
|
||||||
const failSpecWithNoExpectations = !!attrs.failSpecWithNoExpectations;
|
const failSpecWithNoExpectations = !!attrs.failSpecWithNoExpectations;
|
||||||
@@ -11337,7 +11337,7 @@ getJasmineRequireObj().TreeProcessor = function() {
|
|||||||
const childFns = wrapChildren(tree, 0);
|
const childFns = wrapChildren(tree, 0);
|
||||||
|
|
||||||
await new Promise(function(resolve) {
|
await new Promise(function(resolve) {
|
||||||
queueRunnerFactory({
|
runQueue({
|
||||||
queueableFns: childFns,
|
queueableFns: childFns,
|
||||||
userContext: tree.sharedUserContext(),
|
userContext: tree.sharedUserContext(),
|
||||||
onException: function() {
|
onException: function() {
|
||||||
@@ -11507,7 +11507,7 @@ getJasmineRequireObj().TreeProcessor = function() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
queueRunnerFactory({
|
runQueue({
|
||||||
onComplete: function() {
|
onComplete: function() {
|
||||||
const args = Array.prototype.slice.call(arguments, [0]);
|
const args = Array.prototype.slice.call(arguments, [0]);
|
||||||
node.cleanupBeforeAfter();
|
node.cleanupBeforeAfter();
|
||||||
@@ -11530,7 +11530,7 @@ getJasmineRequireObj().TreeProcessor = function() {
|
|||||||
return {
|
return {
|
||||||
fn: function(done) {
|
fn: function(done) {
|
||||||
node.execute(
|
node.execute(
|
||||||
queueRunnerFactory,
|
runQueue,
|
||||||
globalErrors,
|
globalErrors,
|
||||||
done,
|
done,
|
||||||
stats[node.id].excluded,
|
stats[node.id].excluded,
|
||||||
|
|||||||
@@ -12,10 +12,10 @@ describe('ReportDispatcher', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('dispatches requested methods to added reporters', function() {
|
it('dispatches requested methods to added reporters', function() {
|
||||||
const queueRunnerFactory = jasmine.createSpy('queueRunner'),
|
const runQueue = jasmine.createSpy('runQueue'),
|
||||||
dispatcher = new jasmineUnderTest.ReportDispatcher(
|
dispatcher = new jasmineUnderTest.ReportDispatcher(
|
||||||
['foo', 'bar'],
|
['foo', 'bar'],
|
||||||
queueRunnerFactory
|
runQueue
|
||||||
),
|
),
|
||||||
reporter = jasmine.createSpyObj('reporter', ['foo', 'bar']),
|
reporter = jasmine.createSpyObj('reporter', ['foo', 'bar']),
|
||||||
anotherReporter = jasmine.createSpyObj('reporter', ['foo', 'bar']);
|
anotherReporter = jasmine.createSpyObj('reporter', ['foo', 'bar']);
|
||||||
@@ -25,7 +25,7 @@ describe('ReportDispatcher', function() {
|
|||||||
|
|
||||||
dispatcher.foo(123, 456);
|
dispatcher.foo(123, 456);
|
||||||
|
|
||||||
expect(queueRunnerFactory).toHaveBeenCalledWith(
|
expect(runQueue).toHaveBeenCalledWith(
|
||||||
jasmine.objectContaining({
|
jasmine.objectContaining({
|
||||||
queueableFns: [
|
queueableFns: [
|
||||||
{ fn: jasmine.any(Function) },
|
{ fn: jasmine.any(Function) },
|
||||||
@@ -35,7 +35,7 @@ describe('ReportDispatcher', function() {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
let fns = queueRunnerFactory.calls.mostRecent().args[0].queueableFns;
|
let fns = runQueue.calls.mostRecent().args[0].queueableFns;
|
||||||
fns[0].fn();
|
fns[0].fn();
|
||||||
expect(reporter.foo).toHaveBeenCalledWith(123, 456);
|
expect(reporter.foo).toHaveBeenCalledWith(123, 456);
|
||||||
expect(reporter.foo.calls.mostRecent().object).toBe(reporter);
|
expect(reporter.foo.calls.mostRecent().object).toBe(reporter);
|
||||||
@@ -44,11 +44,11 @@ describe('ReportDispatcher', function() {
|
|||||||
expect(anotherReporter.foo).toHaveBeenCalledWith(123, 456);
|
expect(anotherReporter.foo).toHaveBeenCalledWith(123, 456);
|
||||||
expect(anotherReporter.foo.calls.mostRecent().object).toBe(anotherReporter);
|
expect(anotherReporter.foo.calls.mostRecent().object).toBe(anotherReporter);
|
||||||
|
|
||||||
queueRunnerFactory.calls.reset();
|
runQueue.calls.reset();
|
||||||
|
|
||||||
dispatcher.bar('a', 'b');
|
dispatcher.bar('a', 'b');
|
||||||
|
|
||||||
expect(queueRunnerFactory).toHaveBeenCalledWith(
|
expect(runQueue).toHaveBeenCalledWith(
|
||||||
jasmine.objectContaining({
|
jasmine.objectContaining({
|
||||||
queueableFns: [
|
queueableFns: [
|
||||||
{ fn: jasmine.any(Function) },
|
{ fn: jasmine.any(Function) },
|
||||||
@@ -58,7 +58,7 @@ describe('ReportDispatcher', function() {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
fns = queueRunnerFactory.calls.mostRecent().args[0].queueableFns;
|
fns = runQueue.calls.mostRecent().args[0].queueableFns;
|
||||||
fns[0].fn();
|
fns[0].fn();
|
||||||
expect(reporter.bar).toHaveBeenCalledWith('a', 'b');
|
expect(reporter.bar).toHaveBeenCalledWith('a', 'b');
|
||||||
|
|
||||||
@@ -67,17 +67,14 @@ describe('ReportDispatcher', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("does not dispatch to a reporter if the reporter doesn't accept the method", function() {
|
it("does not dispatch to a reporter if the reporter doesn't accept the method", function() {
|
||||||
const queueRunnerFactory = jasmine.createSpy('queueRunner'),
|
const runQueue = jasmine.createSpy('runQueue'),
|
||||||
dispatcher = new jasmineUnderTest.ReportDispatcher(
|
dispatcher = new jasmineUnderTest.ReportDispatcher(['foo'], runQueue),
|
||||||
['foo'],
|
|
||||||
queueRunnerFactory
|
|
||||||
),
|
|
||||||
reporter = jasmine.createSpyObj('reporter', ['baz']);
|
reporter = jasmine.createSpyObj('reporter', ['baz']);
|
||||||
|
|
||||||
dispatcher.addReporter(reporter);
|
dispatcher.addReporter(reporter);
|
||||||
|
|
||||||
dispatcher.foo(123, 456);
|
dispatcher.foo(123, 456);
|
||||||
expect(queueRunnerFactory).toHaveBeenCalledWith(
|
expect(runQueue).toHaveBeenCalledWith(
|
||||||
jasmine.objectContaining({
|
jasmine.objectContaining({
|
||||||
queueableFns: []
|
queueableFns: []
|
||||||
})
|
})
|
||||||
@@ -85,33 +82,33 @@ describe('ReportDispatcher', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("allows providing a fallback reporter in case there's no other reporter", function() {
|
it("allows providing a fallback reporter in case there's no other reporter", function() {
|
||||||
const queueRunnerFactory = jasmine.createSpy('queueRunner'),
|
const runQueue = jasmine.createSpy('runQueue'),
|
||||||
dispatcher = new jasmineUnderTest.ReportDispatcher(
|
dispatcher = new jasmineUnderTest.ReportDispatcher(
|
||||||
['foo', 'bar'],
|
['foo', 'bar'],
|
||||||
queueRunnerFactory
|
runQueue
|
||||||
),
|
),
|
||||||
reporter = jasmine.createSpyObj('reporter', ['foo', 'bar']);
|
reporter = jasmine.createSpyObj('reporter', ['foo', 'bar']);
|
||||||
|
|
||||||
dispatcher.provideFallbackReporter(reporter);
|
dispatcher.provideFallbackReporter(reporter);
|
||||||
dispatcher.foo(123, 456);
|
dispatcher.foo(123, 456);
|
||||||
|
|
||||||
expect(queueRunnerFactory).toHaveBeenCalledWith(
|
expect(runQueue).toHaveBeenCalledWith(
|
||||||
jasmine.objectContaining({
|
jasmine.objectContaining({
|
||||||
queueableFns: [{ fn: jasmine.any(Function) }],
|
queueableFns: [{ fn: jasmine.any(Function) }],
|
||||||
isReporter: true
|
isReporter: true
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
const fns = queueRunnerFactory.calls.mostRecent().args[0].queueableFns;
|
const fns = runQueue.calls.mostRecent().args[0].queueableFns;
|
||||||
fns[0].fn();
|
fns[0].fn();
|
||||||
expect(reporter.foo).toHaveBeenCalledWith(123, 456);
|
expect(reporter.foo).toHaveBeenCalledWith(123, 456);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('does not call fallback reporting methods when another reporter is provided', function() {
|
it('does not call fallback reporting methods when another reporter is provided', function() {
|
||||||
const queueRunnerFactory = jasmine.createSpy('queueRunner'),
|
const runQueue = jasmine.createSpy('runQueue'),
|
||||||
dispatcher = new jasmineUnderTest.ReportDispatcher(
|
dispatcher = new jasmineUnderTest.ReportDispatcher(
|
||||||
['foo', 'bar'],
|
['foo', 'bar'],
|
||||||
queueRunnerFactory
|
runQueue
|
||||||
),
|
),
|
||||||
reporter = jasmine.createSpyObj('reporter', ['foo', 'bar']),
|
reporter = jasmine.createSpyObj('reporter', ['foo', 'bar']),
|
||||||
fallbackReporter = jasmine.createSpyObj('otherReporter', ['foo', 'bar']);
|
fallbackReporter = jasmine.createSpyObj('otherReporter', ['foo', 'bar']);
|
||||||
@@ -120,38 +117,38 @@ describe('ReportDispatcher', function() {
|
|||||||
dispatcher.addReporter(reporter);
|
dispatcher.addReporter(reporter);
|
||||||
dispatcher.foo(123, 456);
|
dispatcher.foo(123, 456);
|
||||||
|
|
||||||
expect(queueRunnerFactory).toHaveBeenCalledWith(
|
expect(runQueue).toHaveBeenCalledWith(
|
||||||
jasmine.objectContaining({
|
jasmine.objectContaining({
|
||||||
queueableFns: [{ fn: jasmine.any(Function) }],
|
queueableFns: [{ fn: jasmine.any(Function) }],
|
||||||
isReporter: true
|
isReporter: true
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
const fns = queueRunnerFactory.calls.mostRecent().args[0].queueableFns;
|
const fns = runQueue.calls.mostRecent().args[0].queueableFns;
|
||||||
fns[0].fn();
|
fns[0].fn();
|
||||||
expect(reporter.foo).toHaveBeenCalledWith(123, 456);
|
expect(reporter.foo).toHaveBeenCalledWith(123, 456);
|
||||||
expect(fallbackReporter.foo).not.toHaveBeenCalledWith(123, 456);
|
expect(fallbackReporter.foo).not.toHaveBeenCalledWith(123, 456);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('allows registered reporters to be cleared', function() {
|
it('allows registered reporters to be cleared', function() {
|
||||||
const queueRunnerFactory = jasmine.createSpy('queueRunner'),
|
const runQueue = jasmine.createSpy('runQueue'),
|
||||||
dispatcher = new jasmineUnderTest.ReportDispatcher(
|
dispatcher = new jasmineUnderTest.ReportDispatcher(
|
||||||
['foo', 'bar'],
|
['foo', 'bar'],
|
||||||
queueRunnerFactory
|
runQueue
|
||||||
),
|
),
|
||||||
reporter1 = jasmine.createSpyObj('reporter1', ['foo', 'bar']),
|
reporter1 = jasmine.createSpyObj('reporter1', ['foo', 'bar']),
|
||||||
reporter2 = jasmine.createSpyObj('reporter2', ['foo', 'bar']);
|
reporter2 = jasmine.createSpyObj('reporter2', ['foo', 'bar']);
|
||||||
|
|
||||||
dispatcher.addReporter(reporter1);
|
dispatcher.addReporter(reporter1);
|
||||||
dispatcher.foo(123);
|
dispatcher.foo(123);
|
||||||
expect(queueRunnerFactory).toHaveBeenCalledWith(
|
expect(runQueue).toHaveBeenCalledWith(
|
||||||
jasmine.objectContaining({
|
jasmine.objectContaining({
|
||||||
queueableFns: [{ fn: jasmine.any(Function) }],
|
queueableFns: [{ fn: jasmine.any(Function) }],
|
||||||
isReporter: true
|
isReporter: true
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
let fns = queueRunnerFactory.calls.mostRecent().args[0].queueableFns;
|
let fns = runQueue.calls.mostRecent().args[0].queueableFns;
|
||||||
fns[0].fn();
|
fns[0].fn();
|
||||||
expect(reporter1.foo).toHaveBeenCalledWith(123);
|
expect(reporter1.foo).toHaveBeenCalledWith(123);
|
||||||
|
|
||||||
@@ -159,14 +156,14 @@ describe('ReportDispatcher', function() {
|
|||||||
dispatcher.addReporter(reporter2);
|
dispatcher.addReporter(reporter2);
|
||||||
dispatcher.bar(456);
|
dispatcher.bar(456);
|
||||||
|
|
||||||
expect(queueRunnerFactory).toHaveBeenCalledWith(
|
expect(runQueue).toHaveBeenCalledWith(
|
||||||
jasmine.objectContaining({
|
jasmine.objectContaining({
|
||||||
queueableFns: [{ fn: jasmine.any(Function) }],
|
queueableFns: [{ fn: jasmine.any(Function) }],
|
||||||
isReporter: true
|
isReporter: true
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
fns = queueRunnerFactory.calls.mostRecent().args[0].queueableFns;
|
fns = runQueue.calls.mostRecent().args[0].queueableFns;
|
||||||
fns[0].fn();
|
fns[0].fn();
|
||||||
expect(reporter1.bar).not.toHaveBeenCalled();
|
expect(reporter1.bar).not.toHaveBeenCalled();
|
||||||
expect(reporter2.bar).toHaveBeenCalledWith(456);
|
expect(reporter2.bar).toHaveBeenCalledWith(456);
|
||||||
|
|||||||
@@ -312,11 +312,11 @@ describe('Spec', function() {
|
|||||||
resultCallback: function() {}
|
resultCallback: function() {}
|
||||||
});
|
});
|
||||||
|
|
||||||
function queueRunnerFactory(attrs) {
|
function runQueue(attrs) {
|
||||||
spec.result.status = 'failed';
|
spec.result.status = 'failed';
|
||||||
attrs.onComplete();
|
attrs.onComplete();
|
||||||
}
|
}
|
||||||
spec.execute(queueRunnerFactory, null, done);
|
spec.execute(runQueue, null, done);
|
||||||
|
|
||||||
expect(done).toHaveBeenCalledWith(
|
expect(done).toHaveBeenCalledWith(
|
||||||
jasmine.any(jasmineUnderTest.StopExecutionError)
|
jasmine.any(jasmineUnderTest.StopExecutionError)
|
||||||
@@ -340,14 +340,14 @@ describe('Spec', function() {
|
|||||||
timer: timer
|
timer: timer
|
||||||
});
|
});
|
||||||
|
|
||||||
function queueRunnerFactory(config) {
|
function runQueue(config) {
|
||||||
config.queueableFns.forEach(function(qf) {
|
config.queueableFns.forEach(function(qf) {
|
||||||
qf.fn();
|
qf.fn();
|
||||||
});
|
});
|
||||||
config.onComplete();
|
config.onComplete();
|
||||||
}
|
}
|
||||||
|
|
||||||
spec.execute(queueRunnerFactory, null, function() {});
|
spec.execute(runQueue, null, function() {});
|
||||||
expect(duration).toBe(77000);
|
expect(duration).toBe(77000);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -649,7 +649,7 @@ describe('Spec', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('treats multiple done calls as late errors', function() {
|
it('treats multiple done calls as late errors', function() {
|
||||||
const queueRunnerFactory = jasmine.createSpy('queueRunnerFactory'),
|
const runQueue = jasmine.createSpy('runQueue'),
|
||||||
onLateError = jasmine.createSpy('onLateError'),
|
onLateError = jasmine.createSpy('onLateError'),
|
||||||
spec = new jasmineUnderTest.Spec({
|
spec = new jasmineUnderTest.Spec({
|
||||||
onLateError: onLateError,
|
onLateError: onLateError,
|
||||||
@@ -659,10 +659,10 @@ describe('Spec', function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
spec.execute(queueRunnerFactory);
|
spec.execute(runQueue);
|
||||||
|
|
||||||
expect(queueRunnerFactory).toHaveBeenCalled();
|
expect(runQueue).toHaveBeenCalled();
|
||||||
queueRunnerFactory.calls.argsFor(0)[0].onMultipleDone();
|
runQueue.calls.argsFor(0)[0].onMultipleDone();
|
||||||
|
|
||||||
expect(onLateError).toHaveBeenCalledTimes(1);
|
expect(onLateError).toHaveBeenCalledTimes(1);
|
||||||
expect(onLateError.calls.argsFor(0)[0]).toBeInstanceOf(Error);
|
expect(onLateError.calls.argsFor(0)[0]).toBeInstanceOf(Error);
|
||||||
@@ -709,7 +709,7 @@ describe('Spec', function() {
|
|||||||
resultCallback: resultCallback
|
resultCallback: resultCallback
|
||||||
});
|
});
|
||||||
|
|
||||||
function queueRunnerFactory(config) {
|
function runQueue(config) {
|
||||||
spec.debugLog('msg');
|
spec.debugLog('msg');
|
||||||
for (const fn of config.queueableFns) {
|
for (const fn of config.queueableFns) {
|
||||||
fn.fn();
|
fn.fn();
|
||||||
@@ -717,7 +717,7 @@ describe('Spec', function() {
|
|||||||
config.onComplete(false);
|
config.onComplete(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
spec.execute(queueRunnerFactory, null, function() {});
|
spec.execute(runQueue, null, function() {});
|
||||||
expect(resultCallback).toHaveBeenCalledWith(
|
expect(resultCallback).toHaveBeenCalledWith(
|
||||||
jasmine.objectContaining({ debugLogs: null }),
|
jasmine.objectContaining({ debugLogs: null }),
|
||||||
undefined
|
undefined
|
||||||
@@ -733,7 +733,7 @@ describe('Spec', function() {
|
|||||||
resultCallback: resultCallback
|
resultCallback: resultCallback
|
||||||
});
|
});
|
||||||
|
|
||||||
function queueRunnerFactory(config) {
|
function runQueue(config) {
|
||||||
spec.debugLog('msg');
|
spec.debugLog('msg');
|
||||||
for (const fn of config.queueableFns) {
|
for (const fn of config.queueableFns) {
|
||||||
fn.fn();
|
fn.fn();
|
||||||
@@ -741,7 +741,7 @@ describe('Spec', function() {
|
|||||||
config.onComplete(false);
|
config.onComplete(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
spec.execute(queueRunnerFactory, null, function() {});
|
spec.execute(runQueue, null, function() {});
|
||||||
expect(resultCallback).toHaveBeenCalled();
|
expect(resultCallback).toHaveBeenCalled();
|
||||||
expect(spec.result.debugLogs).toBeNull();
|
expect(spec.result.debugLogs).toBeNull();
|
||||||
});
|
});
|
||||||
@@ -762,7 +762,7 @@ describe('Spec', function() {
|
|||||||
|
|
||||||
timer.elapsed.and.returnValue(timestamp);
|
timer.elapsed.and.returnValue(timestamp);
|
||||||
|
|
||||||
function queueRunnerFactory(config) {
|
function runQueue(config) {
|
||||||
spec.debugLog('msg');
|
spec.debugLog('msg');
|
||||||
spec.handleException(new Error('nope'));
|
spec.handleException(new Error('nope'));
|
||||||
for (const fn of config.queueableFns) {
|
for (const fn of config.queueableFns) {
|
||||||
@@ -771,7 +771,7 @@ describe('Spec', function() {
|
|||||||
config.onComplete(true);
|
config.onComplete(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
spec.execute(queueRunnerFactory, null, function() {});
|
spec.execute(runQueue, null, function() {});
|
||||||
expect(resultCallback).toHaveBeenCalledWith(
|
expect(resultCallback).toHaveBeenCalledWith(
|
||||||
jasmine.objectContaining({
|
jasmine.objectContaining({
|
||||||
debugLogs: [{ message: 'msg', timestamp: timestamp }]
|
debugLogs: [{ message: 'msg', timestamp: timestamp }]
|
||||||
|
|||||||
@@ -280,20 +280,20 @@ describe('TreeProcessor', function() {
|
|||||||
children: [leaf],
|
children: [leaf],
|
||||||
userContext: { root: 'context' }
|
userContext: { root: 'context' }
|
||||||
});
|
});
|
||||||
const queueRunner = jasmine.createSpy('queueRunner');
|
const runQueue = jasmine.createSpy('runQueue');
|
||||||
const globalErrors = 'the globalErrors instance';
|
const globalErrors = 'the globalErrors instance';
|
||||||
const detectLateRejectionHandling = true;
|
const detectLateRejectionHandling = true;
|
||||||
const processor = new jasmineUnderTest.TreeProcessor({
|
const processor = new jasmineUnderTest.TreeProcessor({
|
||||||
tree: node,
|
tree: node,
|
||||||
runnableIds: [leaf.id],
|
runnableIds: [leaf.id],
|
||||||
queueRunnerFactory: queueRunner,
|
runQueue,
|
||||||
globalErrors,
|
globalErrors,
|
||||||
detectLateRejectionHandling
|
detectLateRejectionHandling
|
||||||
});
|
});
|
||||||
|
|
||||||
const promise = processor.execute();
|
const promise = processor.execute();
|
||||||
|
|
||||||
expect(queueRunner).toHaveBeenCalledWith({
|
expect(runQueue).toHaveBeenCalledWith({
|
||||||
onComplete: jasmine.any(Function),
|
onComplete: jasmine.any(Function),
|
||||||
onException: jasmine.any(Function),
|
onException: jasmine.any(Function),
|
||||||
userContext: { root: 'context' },
|
userContext: { root: 'context' },
|
||||||
@@ -301,10 +301,10 @@ describe('TreeProcessor', function() {
|
|||||||
onMultipleDone: null
|
onMultipleDone: null
|
||||||
});
|
});
|
||||||
|
|
||||||
const queueRunnerArgs = queueRunner.calls.mostRecent().args[0];
|
const runQueueArgs = runQueue.calls.mostRecent().args[0];
|
||||||
queueRunnerArgs.queueableFns[0].fn('foo');
|
runQueueArgs.queueableFns[0].fn('foo');
|
||||||
expect(leaf.execute).toHaveBeenCalledWith(
|
expect(leaf.execute).toHaveBeenCalledWith(
|
||||||
queueRunner,
|
runQueue,
|
||||||
globalErrors,
|
globalErrors,
|
||||||
'foo',
|
'foo',
|
||||||
false,
|
false,
|
||||||
@@ -312,7 +312,7 @@ describe('TreeProcessor', function() {
|
|||||||
detectLateRejectionHandling
|
detectLateRejectionHandling
|
||||||
);
|
);
|
||||||
|
|
||||||
queueRunnerArgs.onComplete();
|
runQueueArgs.onComplete();
|
||||||
await expectAsync(promise).toBeResolvedTo(undefined);
|
await expectAsync(promise).toBeResolvedTo(undefined);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -321,19 +321,19 @@ describe('TreeProcessor', function() {
|
|||||||
root = new Node({ children: [node], userContext: { root: 'context' } }),
|
root = new Node({ children: [node], userContext: { root: 'context' } }),
|
||||||
nodeStart = jasmine.createSpy('nodeStart'),
|
nodeStart = jasmine.createSpy('nodeStart'),
|
||||||
nodeComplete = jasmine.createSpy('nodeComplete'),
|
nodeComplete = jasmine.createSpy('nodeComplete'),
|
||||||
queueRunner = jasmine.createSpy('queueRunner'),
|
runQueue = jasmine.createSpy('runQueue'),
|
||||||
processor = new jasmineUnderTest.TreeProcessor({
|
processor = new jasmineUnderTest.TreeProcessor({
|
||||||
tree: root,
|
tree: root,
|
||||||
runnableIds: [node.id],
|
runnableIds: [node.id],
|
||||||
nodeStart: nodeStart,
|
nodeStart: nodeStart,
|
||||||
nodeComplete: nodeComplete,
|
nodeComplete: nodeComplete,
|
||||||
queueRunnerFactory: queueRunner
|
runQueue
|
||||||
}),
|
}),
|
||||||
nodeDone = jasmine.createSpy('nodeDone');
|
nodeDone = jasmine.createSpy('nodeDone');
|
||||||
|
|
||||||
const promise = processor.execute();
|
const promise = processor.execute();
|
||||||
|
|
||||||
expect(queueRunner).toHaveBeenCalledWith({
|
expect(runQueue).toHaveBeenCalledWith({
|
||||||
onComplete: jasmine.any(Function),
|
onComplete: jasmine.any(Function),
|
||||||
onException: jasmine.any(Function),
|
onException: jasmine.any(Function),
|
||||||
userContext: { root: 'context' },
|
userContext: { root: 'context' },
|
||||||
@@ -341,9 +341,9 @@ describe('TreeProcessor', function() {
|
|||||||
onMultipleDone: null
|
onMultipleDone: null
|
||||||
});
|
});
|
||||||
|
|
||||||
const queueRunnerArgs = queueRunner.calls.mostRecent().args[0];
|
const runQueueArgs = runQueue.calls.mostRecent().args[0];
|
||||||
queueRunnerArgs.queueableFns[0].fn(nodeDone);
|
runQueueArgs.queueableFns[0].fn(nodeDone);
|
||||||
expect(queueRunner).toHaveBeenCalledWith({
|
expect(runQueue).toHaveBeenCalledWith({
|
||||||
onComplete: jasmine.any(Function),
|
onComplete: jasmine.any(Function),
|
||||||
onMultipleDone: null,
|
onMultipleDone: null,
|
||||||
queueableFns: [{ fn: jasmine.any(Function) }],
|
queueableFns: [{ fn: jasmine.any(Function) }],
|
||||||
@@ -352,19 +352,19 @@ describe('TreeProcessor', function() {
|
|||||||
onMultipleDone: null
|
onMultipleDone: null
|
||||||
});
|
});
|
||||||
|
|
||||||
queueRunner.calls.mostRecent().args[0].queueableFns[0].fn('foo');
|
runQueue.calls.mostRecent().args[0].queueableFns[0].fn('foo');
|
||||||
expect(nodeStart).toHaveBeenCalledWith(node, 'foo');
|
expect(nodeStart).toHaveBeenCalledWith(node, 'foo');
|
||||||
|
|
||||||
node.getResult.and.returnValue({ my: 'result' });
|
node.getResult.and.returnValue({ my: 'result' });
|
||||||
|
|
||||||
queueRunner.calls.mostRecent().args[0].onComplete();
|
runQueue.calls.mostRecent().args[0].onComplete();
|
||||||
expect(nodeComplete).toHaveBeenCalledWith(
|
expect(nodeComplete).toHaveBeenCalledWith(
|
||||||
node,
|
node,
|
||||||
{ my: 'result' },
|
{ my: 'result' },
|
||||||
jasmine.any(Function)
|
jasmine.any(Function)
|
||||||
);
|
);
|
||||||
|
|
||||||
queueRunnerArgs.onComplete();
|
runQueueArgs.onComplete();
|
||||||
await expectAsync(promise).toBeResolvedTo(undefined);
|
await expectAsync(promise).toBeResolvedTo(undefined);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -373,13 +373,13 @@ describe('TreeProcessor', function() {
|
|||||||
const leaf2 = new Leaf();
|
const leaf2 = new Leaf();
|
||||||
const node = new Node({ children: [leaf1, leaf2] });
|
const node = new Node({ children: [leaf1, leaf2] });
|
||||||
const root = new Node({ children: [node] });
|
const root = new Node({ children: [node] });
|
||||||
const queueRunner = jasmine.createSpy('queueRunner');
|
const runQueue = jasmine.createSpy('runQueue');
|
||||||
const globalErrors = 'the globalErrors instance';
|
const globalErrors = 'the globalErrors instance';
|
||||||
const detectLateRejectionHandling = false;
|
const detectLateRejectionHandling = false;
|
||||||
const processor = new jasmineUnderTest.TreeProcessor({
|
const processor = new jasmineUnderTest.TreeProcessor({
|
||||||
tree: root,
|
tree: root,
|
||||||
runnableIds: [node.id],
|
runnableIds: [node.id],
|
||||||
queueRunnerFactory: queueRunner,
|
runQueue,
|
||||||
globalErrors,
|
globalErrors,
|
||||||
detectLateRejectionHandling
|
detectLateRejectionHandling
|
||||||
});
|
});
|
||||||
@@ -387,15 +387,15 @@ describe('TreeProcessor', function() {
|
|||||||
const nodeDone = jasmine.createSpy('nodeDone');
|
const nodeDone = jasmine.createSpy('nodeDone');
|
||||||
|
|
||||||
processor.execute(treeComplete);
|
processor.execute(treeComplete);
|
||||||
let queueableFns = queueRunner.calls.mostRecent().args[0].queueableFns;
|
let queueableFns = runQueue.calls.mostRecent().args[0].queueableFns;
|
||||||
queueableFns[0].fn(nodeDone);
|
queueableFns[0].fn(nodeDone);
|
||||||
|
|
||||||
queueableFns = queueRunner.calls.mostRecent().args[0].queueableFns;
|
queueableFns = runQueue.calls.mostRecent().args[0].queueableFns;
|
||||||
expect(queueableFns.length).toBe(3);
|
expect(queueableFns.length).toBe(3);
|
||||||
|
|
||||||
queueableFns[1].fn('foo');
|
queueableFns[1].fn('foo');
|
||||||
expect(leaf1.execute).toHaveBeenCalledWith(
|
expect(leaf1.execute).toHaveBeenCalledWith(
|
||||||
queueRunner,
|
runQueue,
|
||||||
globalErrors,
|
globalErrors,
|
||||||
'foo',
|
'foo',
|
||||||
false,
|
false,
|
||||||
@@ -405,7 +405,7 @@ describe('TreeProcessor', function() {
|
|||||||
|
|
||||||
queueableFns[2].fn('bar');
|
queueableFns[2].fn('bar');
|
||||||
expect(leaf2.execute).toHaveBeenCalledWith(
|
expect(leaf2.execute).toHaveBeenCalledWith(
|
||||||
queueRunner,
|
runQueue,
|
||||||
globalErrors,
|
globalErrors,
|
||||||
'bar',
|
'bar',
|
||||||
false,
|
false,
|
||||||
@@ -418,7 +418,7 @@ describe('TreeProcessor', function() {
|
|||||||
const leaf = new Leaf();
|
const leaf = new Leaf();
|
||||||
const node = new Node({ children: [leaf] });
|
const node = new Node({ children: [leaf] });
|
||||||
const root = new Node({ children: [node] });
|
const root = new Node({ children: [node] });
|
||||||
const queueRunner = jasmine.createSpy('queueRunner');
|
const runQueue = jasmine.createSpy('runQueue');
|
||||||
const globalErrors = 'the globalErrors instance';
|
const globalErrors = 'the globalErrors instance';
|
||||||
const detectLateRejectionHandling = false;
|
const detectLateRejectionHandling = false;
|
||||||
const nodeComplete = jasmine.createSpy('nodeComplete');
|
const nodeComplete = jasmine.createSpy('nodeComplete');
|
||||||
@@ -426,7 +426,7 @@ describe('TreeProcessor', function() {
|
|||||||
tree: root,
|
tree: root,
|
||||||
runnableIds: [node.id],
|
runnableIds: [node.id],
|
||||||
nodeComplete: nodeComplete,
|
nodeComplete: nodeComplete,
|
||||||
queueRunnerFactory: queueRunner,
|
runQueue,
|
||||||
globalErrors,
|
globalErrors,
|
||||||
detectLateRejectionHandling
|
detectLateRejectionHandling
|
||||||
});
|
});
|
||||||
@@ -434,15 +434,15 @@ describe('TreeProcessor', function() {
|
|||||||
const nodeDone = jasmine.createSpy('nodeDone');
|
const nodeDone = jasmine.createSpy('nodeDone');
|
||||||
|
|
||||||
processor.execute(treeComplete);
|
processor.execute(treeComplete);
|
||||||
let queueableFns = queueRunner.calls.mostRecent().args[0].queueableFns;
|
let queueableFns = runQueue.calls.mostRecent().args[0].queueableFns;
|
||||||
queueableFns[0].fn(nodeDone);
|
queueableFns[0].fn(nodeDone);
|
||||||
|
|
||||||
queueableFns = queueRunner.calls.mostRecent().args[0].queueableFns;
|
queueableFns = runQueue.calls.mostRecent().args[0].queueableFns;
|
||||||
expect(queueableFns.length).toBe(2);
|
expect(queueableFns.length).toBe(2);
|
||||||
|
|
||||||
queueableFns[1].fn('foo');
|
queueableFns[1].fn('foo');
|
||||||
expect(leaf.execute).toHaveBeenCalledWith(
|
expect(leaf.execute).toHaveBeenCalledWith(
|
||||||
queueRunner,
|
runQueue,
|
||||||
globalErrors,
|
globalErrors,
|
||||||
'foo',
|
'foo',
|
||||||
false,
|
false,
|
||||||
@@ -450,7 +450,7 @@ describe('TreeProcessor', function() {
|
|||||||
detectLateRejectionHandling
|
detectLateRejectionHandling
|
||||||
);
|
);
|
||||||
|
|
||||||
queueRunner.calls.mostRecent().args[0].onComplete('things');
|
runQueue.calls.mostRecent().args[0].onComplete('things');
|
||||||
expect(nodeComplete).toHaveBeenCalled();
|
expect(nodeComplete).toHaveBeenCalled();
|
||||||
nodeComplete.calls.mostRecent().args[2]();
|
nodeComplete.calls.mostRecent().args[2]();
|
||||||
expect(nodeDone).toHaveBeenCalledWith('things');
|
expect(nodeDone).toHaveBeenCalledWith('things');
|
||||||
@@ -460,7 +460,7 @@ describe('TreeProcessor', function() {
|
|||||||
const leaf1 = new Leaf();
|
const leaf1 = new Leaf();
|
||||||
const node = new Node({ children: [leaf1] });
|
const node = new Node({ children: [leaf1] });
|
||||||
const root = new Node({ children: [node] });
|
const root = new Node({ children: [node] });
|
||||||
const queueRunner = jasmine.createSpy('queueRunner');
|
const runQueue = jasmine.createSpy('runQueue');
|
||||||
const globalErrors = 'the globalErrors instance';
|
const globalErrors = 'the globalErrors instance';
|
||||||
const detectLateRejectionHandling = false;
|
const detectLateRejectionHandling = false;
|
||||||
const nodeStart = jasmine.createSpy('nodeStart');
|
const nodeStart = jasmine.createSpy('nodeStart');
|
||||||
@@ -468,7 +468,7 @@ describe('TreeProcessor', function() {
|
|||||||
const processor = new jasmineUnderTest.TreeProcessor({
|
const processor = new jasmineUnderTest.TreeProcessor({
|
||||||
tree: root,
|
tree: root,
|
||||||
runnableIds: [],
|
runnableIds: [],
|
||||||
queueRunnerFactory: queueRunner,
|
runQueue,
|
||||||
nodeStart: nodeStart,
|
nodeStart: nodeStart,
|
||||||
nodeComplete: nodeComplete,
|
nodeComplete: nodeComplete,
|
||||||
globalErrors,
|
globalErrors,
|
||||||
@@ -478,10 +478,10 @@ describe('TreeProcessor', function() {
|
|||||||
const nodeDone = jasmine.createSpy('nodeDone');
|
const nodeDone = jasmine.createSpy('nodeDone');
|
||||||
|
|
||||||
processor.execute(treeComplete);
|
processor.execute(treeComplete);
|
||||||
let queueableFns = queueRunner.calls.mostRecent().args[0].queueableFns;
|
let queueableFns = runQueue.calls.mostRecent().args[0].queueableFns;
|
||||||
queueableFns[0].fn(nodeDone);
|
queueableFns[0].fn(nodeDone);
|
||||||
|
|
||||||
queueableFns = queueRunner.calls.mostRecent().args[0].queueableFns;
|
queueableFns = runQueue.calls.mostRecent().args[0].queueableFns;
|
||||||
expect(queueableFns.length).toBe(2);
|
expect(queueableFns.length).toBe(2);
|
||||||
|
|
||||||
queueableFns[0].fn('bar');
|
queueableFns[0].fn('bar');
|
||||||
@@ -489,7 +489,7 @@ describe('TreeProcessor', function() {
|
|||||||
|
|
||||||
queueableFns[1].fn('foo');
|
queueableFns[1].fn('foo');
|
||||||
expect(leaf1.execute).toHaveBeenCalledWith(
|
expect(leaf1.execute).toHaveBeenCalledWith(
|
||||||
queueRunner,
|
runQueue,
|
||||||
globalErrors,
|
globalErrors,
|
||||||
'foo',
|
'foo',
|
||||||
true,
|
true,
|
||||||
@@ -499,7 +499,7 @@ describe('TreeProcessor', function() {
|
|||||||
|
|
||||||
node.getResult.and.returnValue({ im: 'disabled' });
|
node.getResult.and.returnValue({ im: 'disabled' });
|
||||||
|
|
||||||
queueRunner.calls.mostRecent().args[0].onComplete();
|
runQueue.calls.mostRecent().args[0].onComplete();
|
||||||
expect(nodeComplete).toHaveBeenCalledWith(
|
expect(nodeComplete).toHaveBeenCalledWith(
|
||||||
node,
|
node,
|
||||||
{ im: 'disabled' },
|
{ im: 'disabled' },
|
||||||
@@ -511,7 +511,7 @@ describe('TreeProcessor', function() {
|
|||||||
const leaf = new Leaf();
|
const leaf = new Leaf();
|
||||||
const node = new Node({ children: [leaf] });
|
const node = new Node({ children: [leaf] });
|
||||||
const root = new Node({ children: [node] });
|
const root = new Node({ children: [node] });
|
||||||
const queueRunner = jasmine.createSpy('queueRunner');
|
const runQueue = jasmine.createSpy('runQueue');
|
||||||
const globalErrors = 'the globalErrors instance';
|
const globalErrors = 'the globalErrors instance';
|
||||||
const detectLateRejectionHandling = false;
|
const detectLateRejectionHandling = false;
|
||||||
const nodeStart = jasmine.createSpy('nodeStart');
|
const nodeStart = jasmine.createSpy('nodeStart');
|
||||||
@@ -519,7 +519,7 @@ describe('TreeProcessor', function() {
|
|||||||
const processor = new jasmineUnderTest.TreeProcessor({
|
const processor = new jasmineUnderTest.TreeProcessor({
|
||||||
tree: root,
|
tree: root,
|
||||||
runnableIds: [],
|
runnableIds: [],
|
||||||
queueRunnerFactory: queueRunner,
|
runQueue,
|
||||||
nodeStart: nodeStart,
|
nodeStart: nodeStart,
|
||||||
nodeComplete: nodeComplete,
|
nodeComplete: nodeComplete,
|
||||||
globalErrors,
|
globalErrors,
|
||||||
@@ -530,15 +530,15 @@ describe('TreeProcessor', function() {
|
|||||||
const nodeDone = jasmine.createSpy('nodeDone');
|
const nodeDone = jasmine.createSpy('nodeDone');
|
||||||
|
|
||||||
processor.execute(treeComplete);
|
processor.execute(treeComplete);
|
||||||
let queueableFns = queueRunner.calls.mostRecent().args[0].queueableFns;
|
let queueableFns = runQueue.calls.mostRecent().args[0].queueableFns;
|
||||||
queueableFns[0].fn(nodeDone);
|
queueableFns[0].fn(nodeDone);
|
||||||
|
|
||||||
queueableFns = queueRunner.calls.mostRecent().args[0].queueableFns;
|
queueableFns = runQueue.calls.mostRecent().args[0].queueableFns;
|
||||||
expect(queueableFns.length).toBe(2);
|
expect(queueableFns.length).toBe(2);
|
||||||
|
|
||||||
queueableFns[1].fn('foo');
|
queueableFns[1].fn('foo');
|
||||||
expect(leaf.execute).toHaveBeenCalledWith(
|
expect(leaf.execute).toHaveBeenCalledWith(
|
||||||
queueRunner,
|
runQueue,
|
||||||
globalErrors,
|
globalErrors,
|
||||||
'foo',
|
'foo',
|
||||||
true,
|
true,
|
||||||
@@ -557,20 +557,20 @@ describe('TreeProcessor', function() {
|
|||||||
]
|
]
|
||||||
}),
|
}),
|
||||||
root = new Node({ children: [node] }),
|
root = new Node({ children: [node] }),
|
||||||
queueRunner = jasmine.createSpy('queueRunner'),
|
runQueue = jasmine.createSpy('runQueue'),
|
||||||
processor = new jasmineUnderTest.TreeProcessor({
|
processor = new jasmineUnderTest.TreeProcessor({
|
||||||
tree: root,
|
tree: root,
|
||||||
runnableIds: [node.id],
|
runnableIds: [node.id],
|
||||||
queueRunnerFactory: queueRunner
|
runQueue
|
||||||
}),
|
}),
|
||||||
treeComplete = jasmine.createSpy('treeComplete'),
|
treeComplete = jasmine.createSpy('treeComplete'),
|
||||||
nodeDone = jasmine.createSpy('nodeDone');
|
nodeDone = jasmine.createSpy('nodeDone');
|
||||||
|
|
||||||
processor.execute(treeComplete);
|
processor.execute(treeComplete);
|
||||||
let queueableFns = queueRunner.calls.mostRecent().args[0].queueableFns;
|
let queueableFns = runQueue.calls.mostRecent().args[0].queueableFns;
|
||||||
queueableFns[0].fn(nodeDone);
|
queueableFns[0].fn(nodeDone);
|
||||||
|
|
||||||
queueableFns = queueRunner.calls.mostRecent().args[0].queueableFns;
|
queueableFns = runQueue.calls.mostRecent().args[0].queueableFns;
|
||||||
|
|
||||||
expect(queueableFns).toEqual([
|
expect(queueableFns).toEqual([
|
||||||
{ fn: jasmine.any(Function) },
|
{ fn: jasmine.any(Function) },
|
||||||
@@ -588,20 +588,20 @@ describe('TreeProcessor', function() {
|
|||||||
afterAllFns
|
afterAllFns
|
||||||
}),
|
}),
|
||||||
root = new Node({ children: [node] }),
|
root = new Node({ children: [node] }),
|
||||||
queueRunner = jasmine.createSpy('queueRunner'),
|
runQueue = jasmine.createSpy('runQueue'),
|
||||||
processor = new jasmineUnderTest.TreeProcessor({
|
processor = new jasmineUnderTest.TreeProcessor({
|
||||||
tree: root,
|
tree: root,
|
||||||
runnableIds: [node.id],
|
runnableIds: [node.id],
|
||||||
queueRunnerFactory: queueRunner
|
runQueue
|
||||||
}),
|
}),
|
||||||
treeComplete = jasmine.createSpy('treeComplete'),
|
treeComplete = jasmine.createSpy('treeComplete'),
|
||||||
nodeDone = jasmine.createSpy('nodeDone');
|
nodeDone = jasmine.createSpy('nodeDone');
|
||||||
|
|
||||||
processor.execute(treeComplete);
|
processor.execute(treeComplete);
|
||||||
let queueableFns = queueRunner.calls.mostRecent().args[0].queueableFns;
|
let queueableFns = runQueue.calls.mostRecent().args[0].queueableFns;
|
||||||
queueableFns[0].fn(nodeDone);
|
queueableFns[0].fn(nodeDone);
|
||||||
|
|
||||||
queueableFns = queueRunner.calls.mostRecent().args[0].queueableFns;
|
queueableFns = runQueue.calls.mostRecent().args[0].queueableFns;
|
||||||
|
|
||||||
expect(queueableFns).toEqual([
|
expect(queueableFns).toEqual([
|
||||||
{ fn: jasmine.any(Function) },
|
{ fn: jasmine.any(Function) },
|
||||||
@@ -617,20 +617,20 @@ describe('TreeProcessor', function() {
|
|||||||
afterAllFns: [{ fn: 'after' }]
|
afterAllFns: [{ fn: 'after' }]
|
||||||
}),
|
}),
|
||||||
root = new Node({ children: [node] }),
|
root = new Node({ children: [node] }),
|
||||||
queueRunner = jasmine.createSpy('queueRunner'),
|
runQueue = jasmine.createSpy('runQueue'),
|
||||||
processor = new jasmineUnderTest.TreeProcessor({
|
processor = new jasmineUnderTest.TreeProcessor({
|
||||||
tree: root,
|
tree: root,
|
||||||
runnableIds: [node.id],
|
runnableIds: [node.id],
|
||||||
queueRunnerFactory: queueRunner
|
runQueue
|
||||||
}),
|
}),
|
||||||
treeComplete = jasmine.createSpy('treeComplete'),
|
treeComplete = jasmine.createSpy('treeComplete'),
|
||||||
nodeDone = jasmine.createSpy('nodeDone');
|
nodeDone = jasmine.createSpy('nodeDone');
|
||||||
|
|
||||||
processor.execute(treeComplete);
|
processor.execute(treeComplete);
|
||||||
let queueableFns = queueRunner.calls.mostRecent().args[0].queueableFns;
|
let queueableFns = runQueue.calls.mostRecent().args[0].queueableFns;
|
||||||
queueableFns[0].fn(nodeDone);
|
queueableFns[0].fn(nodeDone);
|
||||||
|
|
||||||
queueableFns = queueRunner.calls.mostRecent().args[0].queueableFns;
|
queueableFns = runQueue.calls.mostRecent().args[0].queueableFns;
|
||||||
|
|
||||||
expect(queueableFns).toEqual([{ fn: jasmine.any(Function) }]);
|
expect(queueableFns).toEqual([{ fn: jasmine.any(Function) }]);
|
||||||
});
|
});
|
||||||
@@ -644,20 +644,20 @@ describe('TreeProcessor', function() {
|
|||||||
markedPending: false
|
markedPending: false
|
||||||
}),
|
}),
|
||||||
root = new Node({ children: [node] }),
|
root = new Node({ children: [node] }),
|
||||||
queueRunner = jasmine.createSpy('queueRunner'),
|
runQueue = jasmine.createSpy('runQueue'),
|
||||||
processor = new jasmineUnderTest.TreeProcessor({
|
processor = new jasmineUnderTest.TreeProcessor({
|
||||||
tree: root,
|
tree: root,
|
||||||
runnableIds: [node.id],
|
runnableIds: [node.id],
|
||||||
queueRunnerFactory: queueRunner
|
runQueue
|
||||||
}),
|
}),
|
||||||
treeComplete = jasmine.createSpy('treeComplete'),
|
treeComplete = jasmine.createSpy('treeComplete'),
|
||||||
nodeDone = jasmine.createSpy('nodeDone');
|
nodeDone = jasmine.createSpy('nodeDone');
|
||||||
|
|
||||||
processor.execute(treeComplete);
|
processor.execute(treeComplete);
|
||||||
let queueableFns = queueRunner.calls.mostRecent().args[0].queueableFns;
|
let queueableFns = runQueue.calls.mostRecent().args[0].queueableFns;
|
||||||
queueableFns[0].fn(nodeDone);
|
queueableFns[0].fn(nodeDone);
|
||||||
|
|
||||||
queueableFns = queueRunner.calls.mostRecent().args[0].queueableFns;
|
queueableFns = runQueue.calls.mostRecent().args[0].queueableFns;
|
||||||
|
|
||||||
expect(queueableFns).toEqual([
|
expect(queueableFns).toEqual([
|
||||||
{ fn: jasmine.any(Function) },
|
{ fn: jasmine.any(Function) },
|
||||||
@@ -669,16 +669,16 @@ describe('TreeProcessor', function() {
|
|||||||
const leaf1 = new Leaf(),
|
const leaf1 = new Leaf(),
|
||||||
leaf2 = new Leaf(),
|
leaf2 = new Leaf(),
|
||||||
root = new Node({ children: [leaf1, leaf2] }),
|
root = new Node({ children: [leaf1, leaf2] }),
|
||||||
queueRunner = jasmine.createSpy('queueRunner'),
|
runQueue = jasmine.createSpy('runQueue'),
|
||||||
processor = new jasmineUnderTest.TreeProcessor({
|
processor = new jasmineUnderTest.TreeProcessor({
|
||||||
tree: root,
|
tree: root,
|
||||||
runnableIds: [leaf2.id, leaf1.id],
|
runnableIds: [leaf2.id, leaf1.id],
|
||||||
queueRunnerFactory: queueRunner
|
runQueue
|
||||||
}),
|
}),
|
||||||
treeComplete = jasmine.createSpy('treeComplete');
|
treeComplete = jasmine.createSpy('treeComplete');
|
||||||
|
|
||||||
processor.execute(treeComplete);
|
processor.execute(treeComplete);
|
||||||
const queueableFns = queueRunner.calls.mostRecent().args[0].queueableFns;
|
const queueableFns = runQueue.calls.mostRecent().args[0].queueableFns;
|
||||||
queueableFns[0].fn();
|
queueableFns[0].fn();
|
||||||
|
|
||||||
expect(leaf1.execute).not.toHaveBeenCalled();
|
expect(leaf1.execute).not.toHaveBeenCalled();
|
||||||
@@ -693,25 +693,25 @@ describe('TreeProcessor', function() {
|
|||||||
const specified = new Leaf();
|
const specified = new Leaf();
|
||||||
const nonSpecified = new Leaf();
|
const nonSpecified = new Leaf();
|
||||||
const root = new Node({ children: [nonSpecified, specified] });
|
const root = new Node({ children: [nonSpecified, specified] });
|
||||||
const queueRunner = jasmine.createSpy('queueRunner');
|
const runQueue = jasmine.createSpy('runQueue');
|
||||||
const globalErrors = 'the globalErrors instance';
|
const globalErrors = 'the globalErrors instance';
|
||||||
const detectLateRejectionHandling = false;
|
const detectLateRejectionHandling = false;
|
||||||
const processor = new jasmineUnderTest.TreeProcessor({
|
const processor = new jasmineUnderTest.TreeProcessor({
|
||||||
tree: root,
|
tree: root,
|
||||||
runnableIds: [specified.id],
|
runnableIds: [specified.id],
|
||||||
queueRunnerFactory: queueRunner,
|
runQueue,
|
||||||
globalErrors,
|
globalErrors,
|
||||||
detectLateRejectionHandling
|
detectLateRejectionHandling
|
||||||
});
|
});
|
||||||
const treeComplete = jasmine.createSpy('treeComplete');
|
const treeComplete = jasmine.createSpy('treeComplete');
|
||||||
|
|
||||||
processor.execute(treeComplete);
|
processor.execute(treeComplete);
|
||||||
const queueableFns = queueRunner.calls.mostRecent().args[0].queueableFns;
|
const queueableFns = runQueue.calls.mostRecent().args[0].queueableFns;
|
||||||
queueableFns[0].fn();
|
queueableFns[0].fn();
|
||||||
|
|
||||||
expect(nonSpecified.execute).not.toHaveBeenCalled();
|
expect(nonSpecified.execute).not.toHaveBeenCalled();
|
||||||
expect(specified.execute).toHaveBeenCalledWith(
|
expect(specified.execute).toHaveBeenCalledWith(
|
||||||
queueRunner,
|
runQueue,
|
||||||
globalErrors,
|
globalErrors,
|
||||||
undefined,
|
undefined,
|
||||||
false,
|
false,
|
||||||
@@ -722,7 +722,7 @@ describe('TreeProcessor', function() {
|
|||||||
queueableFns[1].fn();
|
queueableFns[1].fn();
|
||||||
|
|
||||||
expect(nonSpecified.execute).toHaveBeenCalledWith(
|
expect(nonSpecified.execute).toHaveBeenCalledWith(
|
||||||
queueRunner,
|
runQueue,
|
||||||
globalErrors,
|
globalErrors,
|
||||||
undefined,
|
undefined,
|
||||||
true,
|
true,
|
||||||
@@ -736,20 +736,19 @@ describe('TreeProcessor', function() {
|
|||||||
childLeaf = new Leaf(),
|
childLeaf = new Leaf(),
|
||||||
specifiedNode = new Node({ children: [childLeaf] }),
|
specifiedNode = new Node({ children: [childLeaf] }),
|
||||||
root = new Node({ children: [specifiedLeaf, specifiedNode] }),
|
root = new Node({ children: [specifiedLeaf, specifiedNode] }),
|
||||||
queueRunner = jasmine.createSpy('queueRunner'),
|
runQueue = jasmine.createSpy('runQueue'),
|
||||||
processor = new jasmineUnderTest.TreeProcessor({
|
processor = new jasmineUnderTest.TreeProcessor({
|
||||||
tree: root,
|
tree: root,
|
||||||
runnableIds: [specifiedNode.id, specifiedLeaf.id],
|
runnableIds: [specifiedNode.id, specifiedLeaf.id],
|
||||||
queueRunnerFactory: queueRunner
|
runQueue
|
||||||
});
|
});
|
||||||
|
|
||||||
processor.execute();
|
processor.execute();
|
||||||
const queueableFns = queueRunner.calls.mostRecent().args[0].queueableFns;
|
const queueableFns = runQueue.calls.mostRecent().args[0].queueableFns;
|
||||||
queueableFns[0].fn();
|
queueableFns[0].fn();
|
||||||
|
|
||||||
expect(specifiedLeaf.execute).not.toHaveBeenCalled();
|
expect(specifiedLeaf.execute).not.toHaveBeenCalled();
|
||||||
const nodeQueueableFns = queueRunner.calls.mostRecent().args[0]
|
const nodeQueueableFns = runQueue.calls.mostRecent().args[0].queueableFns;
|
||||||
.queueableFns;
|
|
||||||
nodeQueueableFns[1].fn();
|
nodeQueueableFns[1].fn();
|
||||||
|
|
||||||
expect(childLeaf.execute).toHaveBeenCalled();
|
expect(childLeaf.execute).toHaveBeenCalled();
|
||||||
@@ -767,38 +766,38 @@ describe('TreeProcessor', function() {
|
|||||||
leaf5 = new Leaf(),
|
leaf5 = new Leaf(),
|
||||||
reentered = new Node({ children: [leaf1, leaf2, leaf3] }),
|
reentered = new Node({ children: [leaf1, leaf2, leaf3] }),
|
||||||
root = new Node({ children: [reentered, leaf4, leaf5] }),
|
root = new Node({ children: [reentered, leaf4, leaf5] }),
|
||||||
queueRunner = jasmine.createSpy('queueRunner'),
|
runQueue = jasmine.createSpy('runQueue'),
|
||||||
processor = new jasmineUnderTest.TreeProcessor({
|
processor = new jasmineUnderTest.TreeProcessor({
|
||||||
tree: root,
|
tree: root,
|
||||||
runnableIds: [leaf1.id, leaf4.id, leaf2.id, leaf5.id, leaf3.id],
|
runnableIds: [leaf1.id, leaf4.id, leaf2.id, leaf5.id, leaf3.id],
|
||||||
queueRunnerFactory: queueRunner
|
runQueue
|
||||||
});
|
});
|
||||||
|
|
||||||
processor.execute();
|
processor.execute();
|
||||||
const queueableFns = queueRunner.calls.mostRecent().args[0].queueableFns;
|
const queueableFns = runQueue.calls.mostRecent().args[0].queueableFns;
|
||||||
expect(queueableFns.length).toBe(5);
|
expect(queueableFns.length).toBe(5);
|
||||||
|
|
||||||
queueableFns[0].fn();
|
queueableFns[0].fn();
|
||||||
expect(queueRunner.calls.mostRecent().args[0].queueableFns.length).toBe(2);
|
expect(runQueue.calls.mostRecent().args[0].queueableFns.length).toBe(2);
|
||||||
queueRunner.calls.mostRecent().args[0].queueableFns[1].fn();
|
runQueue.calls.mostRecent().args[0].queueableFns[1].fn();
|
||||||
expect(leaf1.execute).toHaveBeenCalled();
|
expect(leaf1.execute).toHaveBeenCalled();
|
||||||
|
|
||||||
queueableFns[1].fn();
|
queueableFns[1].fn();
|
||||||
expect(leaf4.execute).toHaveBeenCalled();
|
expect(leaf4.execute).toHaveBeenCalled();
|
||||||
|
|
||||||
queueableFns[2].fn();
|
queueableFns[2].fn();
|
||||||
expect(queueRunner.calls.count()).toBe(3);
|
expect(runQueue.calls.count()).toBe(3);
|
||||||
expect(queueRunner.calls.mostRecent().args[0].queueableFns.length).toBe(2);
|
expect(runQueue.calls.mostRecent().args[0].queueableFns.length).toBe(2);
|
||||||
queueRunner.calls.mostRecent().args[0].queueableFns[1].fn();
|
runQueue.calls.mostRecent().args[0].queueableFns[1].fn();
|
||||||
expect(leaf2.execute).toHaveBeenCalled();
|
expect(leaf2.execute).toHaveBeenCalled();
|
||||||
|
|
||||||
queueableFns[3].fn();
|
queueableFns[3].fn();
|
||||||
expect(leaf5.execute).toHaveBeenCalled();
|
expect(leaf5.execute).toHaveBeenCalled();
|
||||||
|
|
||||||
queueableFns[4].fn();
|
queueableFns[4].fn();
|
||||||
expect(queueRunner.calls.count()).toBe(4);
|
expect(runQueue.calls.count()).toBe(4);
|
||||||
expect(queueRunner.calls.mostRecent().args[0].queueableFns.length).toBe(2);
|
expect(runQueue.calls.mostRecent().args[0].queueableFns.length).toBe(2);
|
||||||
queueRunner.calls.mostRecent().args[0].queueableFns[1].fn();
|
runQueue.calls.mostRecent().args[0].queueableFns[1].fn();
|
||||||
expect(leaf3.execute).toHaveBeenCalled();
|
expect(leaf3.execute).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -811,51 +810,51 @@ describe('TreeProcessor', function() {
|
|||||||
parent = new Node({ children: [leaf1, leaf2, leaf3] }),
|
parent = new Node({ children: [leaf1, leaf2, leaf3] }),
|
||||||
grandparent = new Node({ children: [parent] }),
|
grandparent = new Node({ children: [parent] }),
|
||||||
root = new Node({ children: [grandparent, leaf4, leaf5] }),
|
root = new Node({ children: [grandparent, leaf4, leaf5] }),
|
||||||
queueRunner = jasmine.createSpy('queueRunner'),
|
runQueue = jasmine.createSpy('runQueue'),
|
||||||
processor = new jasmineUnderTest.TreeProcessor({
|
processor = new jasmineUnderTest.TreeProcessor({
|
||||||
tree: root,
|
tree: root,
|
||||||
runnableIds: [leaf1.id, leaf4.id, leaf2.id, leaf5.id, leaf3.id],
|
runnableIds: [leaf1.id, leaf4.id, leaf2.id, leaf5.id, leaf3.id],
|
||||||
queueRunnerFactory: queueRunner
|
runQueue
|
||||||
});
|
});
|
||||||
|
|
||||||
processor.execute();
|
processor.execute();
|
||||||
const queueableFns = queueRunner.calls.mostRecent().args[0].queueableFns;
|
const queueableFns = runQueue.calls.mostRecent().args[0].queueableFns;
|
||||||
expect(queueableFns.length).toBe(5);
|
expect(queueableFns.length).toBe(5);
|
||||||
|
|
||||||
queueableFns[0].fn();
|
queueableFns[0].fn();
|
||||||
expect(queueRunner.calls.count()).toBe(2);
|
expect(runQueue.calls.count()).toBe(2);
|
||||||
expect(queueRunner.calls.mostRecent().args[0].queueableFns.length).toBe(2);
|
expect(runQueue.calls.mostRecent().args[0].queueableFns.length).toBe(2);
|
||||||
|
|
||||||
queueRunner.calls.mostRecent().args[0].queueableFns[1].fn();
|
runQueue.calls.mostRecent().args[0].queueableFns[1].fn();
|
||||||
expect(queueRunner.calls.count()).toBe(3);
|
expect(runQueue.calls.count()).toBe(3);
|
||||||
|
|
||||||
queueRunner.calls.mostRecent().args[0].queueableFns[1].fn();
|
runQueue.calls.mostRecent().args[0].queueableFns[1].fn();
|
||||||
expect(leaf1.execute).toHaveBeenCalled();
|
expect(leaf1.execute).toHaveBeenCalled();
|
||||||
|
|
||||||
queueableFns[1].fn();
|
queueableFns[1].fn();
|
||||||
expect(leaf4.execute).toHaveBeenCalled();
|
expect(leaf4.execute).toHaveBeenCalled();
|
||||||
|
|
||||||
queueableFns[2].fn();
|
queueableFns[2].fn();
|
||||||
expect(queueRunner.calls.count()).toBe(4);
|
expect(runQueue.calls.count()).toBe(4);
|
||||||
expect(queueRunner.calls.mostRecent().args[0].queueableFns.length).toBe(2);
|
expect(runQueue.calls.mostRecent().args[0].queueableFns.length).toBe(2);
|
||||||
|
|
||||||
queueRunner.calls.mostRecent().args[0].queueableFns[1].fn();
|
runQueue.calls.mostRecent().args[0].queueableFns[1].fn();
|
||||||
expect(queueRunner.calls.count()).toBe(5);
|
expect(runQueue.calls.count()).toBe(5);
|
||||||
|
|
||||||
queueRunner.calls.mostRecent().args[0].queueableFns[1].fn();
|
runQueue.calls.mostRecent().args[0].queueableFns[1].fn();
|
||||||
expect(leaf2.execute).toHaveBeenCalled();
|
expect(leaf2.execute).toHaveBeenCalled();
|
||||||
|
|
||||||
queueableFns[3].fn();
|
queueableFns[3].fn();
|
||||||
expect(leaf5.execute).toHaveBeenCalled();
|
expect(leaf5.execute).toHaveBeenCalled();
|
||||||
|
|
||||||
queueableFns[4].fn();
|
queueableFns[4].fn();
|
||||||
expect(queueRunner.calls.count()).toBe(6);
|
expect(runQueue.calls.count()).toBe(6);
|
||||||
expect(queueRunner.calls.mostRecent().args[0].queueableFns.length).toBe(2);
|
expect(runQueue.calls.mostRecent().args[0].queueableFns.length).toBe(2);
|
||||||
|
|
||||||
queueRunner.calls.mostRecent().args[0].queueableFns[1].fn();
|
runQueue.calls.mostRecent().args[0].queueableFns[1].fn();
|
||||||
expect(queueRunner.calls.count()).toBe(7);
|
expect(runQueue.calls.count()).toBe(7);
|
||||||
|
|
||||||
queueRunner.calls.mostRecent().args[0].queueableFns[1].fn();
|
runQueue.calls.mostRecent().args[0].queueableFns[1].fn();
|
||||||
expect(leaf3.execute).toHaveBeenCalled();
|
expect(leaf3.execute).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -865,15 +864,15 @@ describe('TreeProcessor', function() {
|
|||||||
leaf3 = new Leaf(),
|
leaf3 = new Leaf(),
|
||||||
parent = new Node({ children: [leaf2, leaf3] }),
|
parent = new Node({ children: [leaf2, leaf3] }),
|
||||||
root = new Node({ children: [leaf1, parent] }),
|
root = new Node({ children: [leaf1, parent] }),
|
||||||
queueRunner = jasmine.createSpy('queueRunner'),
|
runQueue = jasmine.createSpy('runQueue'),
|
||||||
processor = new jasmineUnderTest.TreeProcessor({
|
processor = new jasmineUnderTest.TreeProcessor({
|
||||||
tree: root,
|
tree: root,
|
||||||
runnableIds: [root.id],
|
runnableIds: [root.id],
|
||||||
queueRunnerFactory: queueRunner
|
runQueue
|
||||||
});
|
});
|
||||||
|
|
||||||
processor.execute();
|
processor.execute();
|
||||||
const queueableFns = queueRunner.calls.mostRecent().args[0].queueableFns;
|
const queueableFns = runQueue.calls.mostRecent().args[0].queueableFns;
|
||||||
expect(queueableFns.length).toBe(2);
|
expect(queueableFns.length).toBe(2);
|
||||||
|
|
||||||
queueableFns[0].fn();
|
queueableFns[0].fn();
|
||||||
@@ -881,7 +880,7 @@ describe('TreeProcessor', function() {
|
|||||||
|
|
||||||
queueableFns[1].fn();
|
queueableFns[1].fn();
|
||||||
|
|
||||||
const childFns = queueRunner.calls.mostRecent().args[0].queueableFns;
|
const childFns = runQueue.calls.mostRecent().args[0].queueableFns;
|
||||||
expect(childFns.length).toBe(3);
|
expect(childFns.length).toBe(3);
|
||||||
childFns[1].fn();
|
childFns[1].fn();
|
||||||
expect(leaf2.execute).toHaveBeenCalled();
|
expect(leaf2.execute).toHaveBeenCalled();
|
||||||
@@ -917,15 +916,15 @@ describe('TreeProcessor', function() {
|
|||||||
leaf11
|
leaf11
|
||||||
]
|
]
|
||||||
}),
|
}),
|
||||||
queueRunner = jasmine.createSpy('queueRunner'),
|
runQueue = jasmine.createSpy('runQueue'),
|
||||||
processor = new jasmineUnderTest.TreeProcessor({
|
processor = new jasmineUnderTest.TreeProcessor({
|
||||||
tree: root,
|
tree: root,
|
||||||
runnableIds: [root.id],
|
runnableIds: [root.id],
|
||||||
queueRunnerFactory: queueRunner
|
runQueue
|
||||||
});
|
});
|
||||||
|
|
||||||
processor.execute();
|
processor.execute();
|
||||||
const queueableFns = queueRunner.calls.mostRecent().args[0].queueableFns;
|
const queueableFns = runQueue.calls.mostRecent().args[0].queueableFns;
|
||||||
expect(queueableFns.length).toBe(11);
|
expect(queueableFns.length).toBe(11);
|
||||||
|
|
||||||
queueableFns[0].fn();
|
queueableFns[0].fn();
|
||||||
@@ -989,11 +988,11 @@ describe('TreeProcessor', function() {
|
|||||||
leaf11
|
leaf11
|
||||||
]
|
]
|
||||||
}),
|
}),
|
||||||
queueRunner = jasmine.createSpy('queueRunner'),
|
runQueue = jasmine.createSpy('runQueue'),
|
||||||
processor = new jasmineUnderTest.TreeProcessor({
|
processor = new jasmineUnderTest.TreeProcessor({
|
||||||
tree: root,
|
tree: root,
|
||||||
runnableIds: [root.id],
|
runnableIds: [root.id],
|
||||||
queueRunnerFactory: queueRunner,
|
runQueue,
|
||||||
orderChildren: function(node) {
|
orderChildren: function(node) {
|
||||||
const children = node.children.slice();
|
const children = node.children.slice();
|
||||||
return children.reverse();
|
return children.reverse();
|
||||||
@@ -1001,7 +1000,7 @@ describe('TreeProcessor', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
processor.execute();
|
processor.execute();
|
||||||
const queueableFns = queueRunner.calls.mostRecent().args[0].queueableFns;
|
const queueableFns = runQueue.calls.mostRecent().args[0].queueableFns;
|
||||||
expect(queueableFns.length).toBe(11);
|
expect(queueableFns.length).toBe(11);
|
||||||
|
|
||||||
queueableFns[0].fn();
|
queueableFns[0].fn();
|
||||||
|
|||||||
@@ -455,7 +455,7 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
deprecator.addDeprecationWarning(runable, deprecation, options);
|
deprecator.addDeprecationWarning(runable, deprecation, options);
|
||||||
};
|
};
|
||||||
|
|
||||||
function queueRunnerFactory(options) {
|
function runQueue(options) {
|
||||||
options.clearStack = options.clearStack || clearStack;
|
options.clearStack = options.clearStack || clearStack;
|
||||||
options.timeout = {
|
options.timeout = {
|
||||||
setTimeout: realSetTimeout,
|
setTimeout: realSetTimeout,
|
||||||
@@ -479,7 +479,7 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
onLateError: recordLateError,
|
onLateError: recordLateError,
|
||||||
specResultCallback,
|
specResultCallback,
|
||||||
specStarted,
|
specStarted,
|
||||||
queueRunnerFactory
|
runQueue
|
||||||
});
|
});
|
||||||
topSuite = suiteBuilder.topSuite;
|
topSuite = suiteBuilder.topSuite;
|
||||||
const deprecator = new j$.Deprecator(topSuite);
|
const deprecator = new j$.Deprecator(topSuite);
|
||||||
@@ -506,7 +506,7 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
j$.reporterEvents,
|
j$.reporterEvents,
|
||||||
function(options) {
|
function(options) {
|
||||||
options.SkipPolicy = j$.NeverSkipPolicy;
|
options.SkipPolicy = j$.NeverSkipPolicy;
|
||||||
return queueRunnerFactory(options);
|
return runQueue(options);
|
||||||
},
|
},
|
||||||
recordLateError
|
recordLateError
|
||||||
);
|
);
|
||||||
@@ -517,7 +517,7 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
focusedRunables: () => suiteBuilder.focusedRunables,
|
focusedRunables: () => suiteBuilder.focusedRunables,
|
||||||
runableResources,
|
runableResources,
|
||||||
reporter,
|
reporter,
|
||||||
queueRunnerFactory,
|
runQueue,
|
||||||
TreeProcessor: j$.TreeProcessor,
|
TreeProcessor: j$.TreeProcessor,
|
||||||
globalErrors,
|
globalErrors,
|
||||||
getConfig: () => config,
|
getConfig: () => config,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
getJasmineRequireObj().ReportDispatcher = function(j$) {
|
getJasmineRequireObj().ReportDispatcher = function(j$) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
function ReportDispatcher(methods, queueRunnerFactory, onLateError) {
|
function ReportDispatcher(methods, runQueue, onLateError) {
|
||||||
const dispatchedMethods = methods || [];
|
const dispatchedMethods = methods || [];
|
||||||
|
|
||||||
for (const method of dispatchedMethods) {
|
for (const method of dispatchedMethods) {
|
||||||
@@ -39,7 +39,7 @@ getJasmineRequireObj().ReportDispatcher = function(j$) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return new Promise(function(resolve) {
|
return new Promise(function(resolve) {
|
||||||
queueRunnerFactory({
|
runQueue({
|
||||||
queueableFns: fns,
|
queueableFns: fns,
|
||||||
onComplete: resolve,
|
onComplete: resolve,
|
||||||
isReporter: true,
|
isReporter: true,
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ getJasmineRequireObj().Runner = function(j$) {
|
|||||||
this.totalSpecsDefined_ = options.totalSpecsDefined;
|
this.totalSpecsDefined_ = options.totalSpecsDefined;
|
||||||
this.focusedRunables_ = options.focusedRunables;
|
this.focusedRunables_ = options.focusedRunables;
|
||||||
this.runableResources_ = options.runableResources;
|
this.runableResources_ = options.runableResources;
|
||||||
this.queueRunnerFactory_ = options.queueRunnerFactory;
|
this.runQueue_ = options.runQueue;
|
||||||
this.TreeProcessor_ = options.TreeProcessor;
|
this.TreeProcessor_ = options.TreeProcessor;
|
||||||
this.globalErrors_ = options.globalErrors;
|
this.globalErrors_ = options.globalErrors;
|
||||||
this.reporter_ = options.reporter;
|
this.reporter_ = options.reporter;
|
||||||
@@ -59,7 +59,7 @@ getJasmineRequireObj().Runner = function(j$) {
|
|||||||
const processor = new this.TreeProcessor_({
|
const processor = new this.TreeProcessor_({
|
||||||
tree: this.topSuite_,
|
tree: this.topSuite_,
|
||||||
runnableIds: runablesToRun,
|
runnableIds: runablesToRun,
|
||||||
queueRunnerFactory: options => {
|
runQueue: options => {
|
||||||
if (options.isLeaf) {
|
if (options.isLeaf) {
|
||||||
// A spec
|
// A spec
|
||||||
options.SkipPolicy = j$.CompleteOnFirstErrorSkipPolicy;
|
options.SkipPolicy = j$.CompleteOnFirstErrorSkipPolicy;
|
||||||
@@ -72,7 +72,7 @@ getJasmineRequireObj().Runner = function(j$) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.queueRunnerFactory_(options);
|
return this.runQueue_(options);
|
||||||
},
|
},
|
||||||
globalErrors: this.globalErrors_,
|
globalErrors: this.globalErrors_,
|
||||||
failSpecWithNoExpectations: config.failSpecWithNoExpectations,
|
failSpecWithNoExpectations: config.failSpecWithNoExpectations,
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ getJasmineRequireObj().Spec = function(j$) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Spec.prototype.execute = function(
|
Spec.prototype.execute = function(
|
||||||
queueRunnerFactory,
|
runQueue,
|
||||||
globalErrors,
|
globalErrors,
|
||||||
onComplete,
|
onComplete,
|
||||||
excluded,
|
excluded,
|
||||||
@@ -155,7 +155,7 @@ getJasmineRequireObj().Spec = function(j$) {
|
|||||||
}
|
}
|
||||||
runnerConfig.queueableFns.push(complete);
|
runnerConfig.queueableFns.push(complete);
|
||||||
|
|
||||||
queueRunnerFactory(runnerConfig);
|
runQueue(runnerConfig);
|
||||||
};
|
};
|
||||||
|
|
||||||
Spec.prototype.reset = function() {
|
Spec.prototype.reset = function() {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ getJasmineRequireObj().TreeProcessor = function() {
|
|||||||
function TreeProcessor(attrs) {
|
function TreeProcessor(attrs) {
|
||||||
const tree = attrs.tree;
|
const tree = attrs.tree;
|
||||||
const runnableIds = attrs.runnableIds;
|
const runnableIds = attrs.runnableIds;
|
||||||
const queueRunnerFactory = attrs.queueRunnerFactory;
|
const runQueue = attrs.runQueue;
|
||||||
const nodeStart = attrs.nodeStart || function() {};
|
const nodeStart = attrs.nodeStart || function() {};
|
||||||
const nodeComplete = attrs.nodeComplete || function() {};
|
const nodeComplete = attrs.nodeComplete || function() {};
|
||||||
const failSpecWithNoExpectations = !!attrs.failSpecWithNoExpectations;
|
const failSpecWithNoExpectations = !!attrs.failSpecWithNoExpectations;
|
||||||
@@ -42,7 +42,7 @@ getJasmineRequireObj().TreeProcessor = function() {
|
|||||||
const childFns = wrapChildren(tree, 0);
|
const childFns = wrapChildren(tree, 0);
|
||||||
|
|
||||||
await new Promise(function(resolve) {
|
await new Promise(function(resolve) {
|
||||||
queueRunnerFactory({
|
runQueue({
|
||||||
queueableFns: childFns,
|
queueableFns: childFns,
|
||||||
userContext: tree.sharedUserContext(),
|
userContext: tree.sharedUserContext(),
|
||||||
onException: function() {
|
onException: function() {
|
||||||
@@ -212,7 +212,7 @@ getJasmineRequireObj().TreeProcessor = function() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
queueRunnerFactory({
|
runQueue({
|
||||||
onComplete: function() {
|
onComplete: function() {
|
||||||
const args = Array.prototype.slice.call(arguments, [0]);
|
const args = Array.prototype.slice.call(arguments, [0]);
|
||||||
node.cleanupBeforeAfter();
|
node.cleanupBeforeAfter();
|
||||||
@@ -235,7 +235,7 @@ getJasmineRequireObj().TreeProcessor = function() {
|
|||||||
return {
|
return {
|
||||||
fn: function(done) {
|
fn: function(done) {
|
||||||
node.execute(
|
node.execute(
|
||||||
queueRunnerFactory,
|
runQueue,
|
||||||
globalErrors,
|
globalErrors,
|
||||||
done,
|
done,
|
||||||
stats[node.id].excluded,
|
stats[node.id].excluded,
|
||||||
|
|||||||
Reference in New Issue
Block a user