Rename queueRunnerFactory to runQueue throughout

This commit is contained in:
Steve Gravrock
2025-08-11 23:05:56 -07:00
parent 5b06531cac
commit c15a1aaa6d
9 changed files with 174 additions and 178 deletions

View File

@@ -842,7 +842,7 @@ getJasmineRequireObj().Spec = function(j$) {
};
Spec.prototype.execute = function(
queueRunnerFactory,
runQueue,
globalErrors,
onComplete,
excluded,
@@ -925,7 +925,7 @@ getJasmineRequireObj().Spec = function(j$) {
}
runnerConfig.queueableFns.push(complete);
queueRunnerFactory(runnerConfig);
runQueue(runnerConfig);
};
Spec.prototype.reset = function() {
@@ -1651,7 +1651,7 @@ getJasmineRequireObj().Env = function(j$) {
deprecator.addDeprecationWarning(runable, deprecation, options);
};
function queueRunnerFactory(options) {
function runQueue(options) {
options.clearStack = options.clearStack || clearStack;
options.timeout = {
setTimeout: realSetTimeout,
@@ -1675,7 +1675,7 @@ getJasmineRequireObj().Env = function(j$) {
onLateError: recordLateError,
specResultCallback,
specStarted,
queueRunnerFactory
runQueue
});
topSuite = suiteBuilder.topSuite;
const deprecator = new j$.Deprecator(topSuite);
@@ -1702,7 +1702,7 @@ getJasmineRequireObj().Env = function(j$) {
j$.reporterEvents,
function(options) {
options.SkipPolicy = j$.NeverSkipPolicy;
return queueRunnerFactory(options);
return runQueue(options);
},
recordLateError
);
@@ -1713,7 +1713,7 @@ getJasmineRequireObj().Env = function(j$) {
focusedRunables: () => suiteBuilder.focusedRunables,
runableResources,
reporter,
queueRunnerFactory,
runQueue,
TreeProcessor: j$.TreeProcessor,
globalErrors,
getConfig: () => config,
@@ -8555,7 +8555,7 @@ getJasmineRequireObj().QueueRunner = function(j$) {
getJasmineRequireObj().ReportDispatcher = function(j$) {
'use strict';
function ReportDispatcher(methods, queueRunnerFactory, onLateError) {
function ReportDispatcher(methods, runQueue, onLateError) {
const dispatchedMethods = methods || [];
for (const method of dispatchedMethods) {
@@ -8593,7 +8593,7 @@ getJasmineRequireObj().ReportDispatcher = function(j$) {
}
return new Promise(function(resolve) {
queueRunnerFactory({
runQueue({
queueableFns: fns,
onComplete: resolve,
isReporter: true,
@@ -9407,7 +9407,7 @@ getJasmineRequireObj().Runner = function(j$) {
this.totalSpecsDefined_ = options.totalSpecsDefined;
this.focusedRunables_ = options.focusedRunables;
this.runableResources_ = options.runableResources;
this.queueRunnerFactory_ = options.queueRunnerFactory;
this.runQueue_ = options.runQueue;
this.TreeProcessor_ = options.TreeProcessor;
this.globalErrors_ = options.globalErrors;
this.reporter_ = options.reporter;
@@ -9460,7 +9460,7 @@ getJasmineRequireObj().Runner = function(j$) {
const processor = new this.TreeProcessor_({
tree: this.topSuite_,
runnableIds: runablesToRun,
queueRunnerFactory: options => {
runQueue: options => {
if (options.isLeaf) {
// A spec
options.SkipPolicy = j$.CompleteOnFirstErrorSkipPolicy;
@@ -9473,7 +9473,7 @@ getJasmineRequireObj().Runner = function(j$) {
}
}
return this.queueRunnerFactory_(options);
return this.runQueue_(options);
},
globalErrors: this.globalErrors_,
failSpecWithNoExpectations: config.failSpecWithNoExpectations,
@@ -11297,7 +11297,7 @@ getJasmineRequireObj().TreeProcessor = function() {
function TreeProcessor(attrs) {
const tree = attrs.tree;
const runnableIds = attrs.runnableIds;
const queueRunnerFactory = attrs.queueRunnerFactory;
const runQueue = attrs.runQueue;
const nodeStart = attrs.nodeStart || function() {};
const nodeComplete = attrs.nodeComplete || function() {};
const failSpecWithNoExpectations = !!attrs.failSpecWithNoExpectations;
@@ -11337,7 +11337,7 @@ getJasmineRequireObj().TreeProcessor = function() {
const childFns = wrapChildren(tree, 0);
await new Promise(function(resolve) {
queueRunnerFactory({
runQueue({
queueableFns: childFns,
userContext: tree.sharedUserContext(),
onException: function() {
@@ -11507,7 +11507,7 @@ getJasmineRequireObj().TreeProcessor = function() {
}
};
queueRunnerFactory({
runQueue({
onComplete: function() {
const args = Array.prototype.slice.call(arguments, [0]);
node.cleanupBeforeAfter();
@@ -11530,7 +11530,7 @@ getJasmineRequireObj().TreeProcessor = function() {
return {
fn: function(done) {
node.execute(
queueRunnerFactory,
runQueue,
globalErrors,
done,
stats[node.id].excluded,

View File

@@ -12,10 +12,10 @@ describe('ReportDispatcher', function() {
});
it('dispatches requested methods to added reporters', function() {
const queueRunnerFactory = jasmine.createSpy('queueRunner'),
const runQueue = jasmine.createSpy('runQueue'),
dispatcher = new jasmineUnderTest.ReportDispatcher(
['foo', 'bar'],
queueRunnerFactory
runQueue
),
reporter = jasmine.createSpyObj('reporter', ['foo', 'bar']),
anotherReporter = jasmine.createSpyObj('reporter', ['foo', 'bar']);
@@ -25,7 +25,7 @@ describe('ReportDispatcher', function() {
dispatcher.foo(123, 456);
expect(queueRunnerFactory).toHaveBeenCalledWith(
expect(runQueue).toHaveBeenCalledWith(
jasmine.objectContaining({
queueableFns: [
{ 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();
expect(reporter.foo).toHaveBeenCalledWith(123, 456);
expect(reporter.foo.calls.mostRecent().object).toBe(reporter);
@@ -44,11 +44,11 @@ describe('ReportDispatcher', function() {
expect(anotherReporter.foo).toHaveBeenCalledWith(123, 456);
expect(anotherReporter.foo.calls.mostRecent().object).toBe(anotherReporter);
queueRunnerFactory.calls.reset();
runQueue.calls.reset();
dispatcher.bar('a', 'b');
expect(queueRunnerFactory).toHaveBeenCalledWith(
expect(runQueue).toHaveBeenCalledWith(
jasmine.objectContaining({
queueableFns: [
{ 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();
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() {
const queueRunnerFactory = jasmine.createSpy('queueRunner'),
dispatcher = new jasmineUnderTest.ReportDispatcher(
['foo'],
queueRunnerFactory
),
const runQueue = jasmine.createSpy('runQueue'),
dispatcher = new jasmineUnderTest.ReportDispatcher(['foo'], runQueue),
reporter = jasmine.createSpyObj('reporter', ['baz']);
dispatcher.addReporter(reporter);
dispatcher.foo(123, 456);
expect(queueRunnerFactory).toHaveBeenCalledWith(
expect(runQueue).toHaveBeenCalledWith(
jasmine.objectContaining({
queueableFns: []
})
@@ -85,33 +82,33 @@ describe('ReportDispatcher', 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(
['foo', 'bar'],
queueRunnerFactory
runQueue
),
reporter = jasmine.createSpyObj('reporter', ['foo', 'bar']);
dispatcher.provideFallbackReporter(reporter);
dispatcher.foo(123, 456);
expect(queueRunnerFactory).toHaveBeenCalledWith(
expect(runQueue).toHaveBeenCalledWith(
jasmine.objectContaining({
queueableFns: [{ fn: jasmine.any(Function) }],
isReporter: true
})
);
const fns = queueRunnerFactory.calls.mostRecent().args[0].queueableFns;
const fns = runQueue.calls.mostRecent().args[0].queueableFns;
fns[0].fn();
expect(reporter.foo).toHaveBeenCalledWith(123, 456);
});
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(
['foo', 'bar'],
queueRunnerFactory
runQueue
),
reporter = jasmine.createSpyObj('reporter', ['foo', 'bar']),
fallbackReporter = jasmine.createSpyObj('otherReporter', ['foo', 'bar']);
@@ -120,38 +117,38 @@ describe('ReportDispatcher', function() {
dispatcher.addReporter(reporter);
dispatcher.foo(123, 456);
expect(queueRunnerFactory).toHaveBeenCalledWith(
expect(runQueue).toHaveBeenCalledWith(
jasmine.objectContaining({
queueableFns: [{ fn: jasmine.any(Function) }],
isReporter: true
})
);
const fns = queueRunnerFactory.calls.mostRecent().args[0].queueableFns;
const fns = runQueue.calls.mostRecent().args[0].queueableFns;
fns[0].fn();
expect(reporter.foo).toHaveBeenCalledWith(123, 456);
expect(fallbackReporter.foo).not.toHaveBeenCalledWith(123, 456);
});
it('allows registered reporters to be cleared', function() {
const queueRunnerFactory = jasmine.createSpy('queueRunner'),
const runQueue = jasmine.createSpy('runQueue'),
dispatcher = new jasmineUnderTest.ReportDispatcher(
['foo', 'bar'],
queueRunnerFactory
runQueue
),
reporter1 = jasmine.createSpyObj('reporter1', ['foo', 'bar']),
reporter2 = jasmine.createSpyObj('reporter2', ['foo', 'bar']);
dispatcher.addReporter(reporter1);
dispatcher.foo(123);
expect(queueRunnerFactory).toHaveBeenCalledWith(
expect(runQueue).toHaveBeenCalledWith(
jasmine.objectContaining({
queueableFns: [{ fn: jasmine.any(Function) }],
isReporter: true
})
);
let fns = queueRunnerFactory.calls.mostRecent().args[0].queueableFns;
let fns = runQueue.calls.mostRecent().args[0].queueableFns;
fns[0].fn();
expect(reporter1.foo).toHaveBeenCalledWith(123);
@@ -159,14 +156,14 @@ describe('ReportDispatcher', function() {
dispatcher.addReporter(reporter2);
dispatcher.bar(456);
expect(queueRunnerFactory).toHaveBeenCalledWith(
expect(runQueue).toHaveBeenCalledWith(
jasmine.objectContaining({
queueableFns: [{ fn: jasmine.any(Function) }],
isReporter: true
})
);
fns = queueRunnerFactory.calls.mostRecent().args[0].queueableFns;
fns = runQueue.calls.mostRecent().args[0].queueableFns;
fns[0].fn();
expect(reporter1.bar).not.toHaveBeenCalled();
expect(reporter2.bar).toHaveBeenCalledWith(456);

View File

@@ -312,11 +312,11 @@ describe('Spec', function() {
resultCallback: function() {}
});
function queueRunnerFactory(attrs) {
function runQueue(attrs) {
spec.result.status = 'failed';
attrs.onComplete();
}
spec.execute(queueRunnerFactory, null, done);
spec.execute(runQueue, null, done);
expect(done).toHaveBeenCalledWith(
jasmine.any(jasmineUnderTest.StopExecutionError)
@@ -340,14 +340,14 @@ describe('Spec', function() {
timer: timer
});
function queueRunnerFactory(config) {
function runQueue(config) {
config.queueableFns.forEach(function(qf) {
qf.fn();
});
config.onComplete();
}
spec.execute(queueRunnerFactory, null, function() {});
spec.execute(runQueue, null, function() {});
expect(duration).toBe(77000);
});
@@ -649,7 +649,7 @@ describe('Spec', function() {
});
it('treats multiple done calls as late errors', function() {
const queueRunnerFactory = jasmine.createSpy('queueRunnerFactory'),
const runQueue = jasmine.createSpy('runQueue'),
onLateError = jasmine.createSpy('onLateError'),
spec = new jasmineUnderTest.Spec({
onLateError: onLateError,
@@ -659,10 +659,10 @@ describe('Spec', function() {
}
});
spec.execute(queueRunnerFactory);
spec.execute(runQueue);
expect(queueRunnerFactory).toHaveBeenCalled();
queueRunnerFactory.calls.argsFor(0)[0].onMultipleDone();
expect(runQueue).toHaveBeenCalled();
runQueue.calls.argsFor(0)[0].onMultipleDone();
expect(onLateError).toHaveBeenCalledTimes(1);
expect(onLateError.calls.argsFor(0)[0]).toBeInstanceOf(Error);
@@ -709,7 +709,7 @@ describe('Spec', function() {
resultCallback: resultCallback
});
function queueRunnerFactory(config) {
function runQueue(config) {
spec.debugLog('msg');
for (const fn of config.queueableFns) {
fn.fn();
@@ -717,7 +717,7 @@ describe('Spec', function() {
config.onComplete(false);
}
spec.execute(queueRunnerFactory, null, function() {});
spec.execute(runQueue, null, function() {});
expect(resultCallback).toHaveBeenCalledWith(
jasmine.objectContaining({ debugLogs: null }),
undefined
@@ -733,7 +733,7 @@ describe('Spec', function() {
resultCallback: resultCallback
});
function queueRunnerFactory(config) {
function runQueue(config) {
spec.debugLog('msg');
for (const fn of config.queueableFns) {
fn.fn();
@@ -741,7 +741,7 @@ describe('Spec', function() {
config.onComplete(false);
}
spec.execute(queueRunnerFactory, null, function() {});
spec.execute(runQueue, null, function() {});
expect(resultCallback).toHaveBeenCalled();
expect(spec.result.debugLogs).toBeNull();
});
@@ -762,7 +762,7 @@ describe('Spec', function() {
timer.elapsed.and.returnValue(timestamp);
function queueRunnerFactory(config) {
function runQueue(config) {
spec.debugLog('msg');
spec.handleException(new Error('nope'));
for (const fn of config.queueableFns) {
@@ -771,7 +771,7 @@ describe('Spec', function() {
config.onComplete(true);
}
spec.execute(queueRunnerFactory, null, function() {});
spec.execute(runQueue, null, function() {});
expect(resultCallback).toHaveBeenCalledWith(
jasmine.objectContaining({
debugLogs: [{ message: 'msg', timestamp: timestamp }]

View File

@@ -280,20 +280,20 @@ describe('TreeProcessor', function() {
children: [leaf],
userContext: { root: 'context' }
});
const queueRunner = jasmine.createSpy('queueRunner');
const runQueue = jasmine.createSpy('runQueue');
const globalErrors = 'the globalErrors instance';
const detectLateRejectionHandling = true;
const processor = new jasmineUnderTest.TreeProcessor({
tree: node,
runnableIds: [leaf.id],
queueRunnerFactory: queueRunner,
runQueue,
globalErrors,
detectLateRejectionHandling
});
const promise = processor.execute();
expect(queueRunner).toHaveBeenCalledWith({
expect(runQueue).toHaveBeenCalledWith({
onComplete: jasmine.any(Function),
onException: jasmine.any(Function),
userContext: { root: 'context' },
@@ -301,10 +301,10 @@ describe('TreeProcessor', function() {
onMultipleDone: null
});
const queueRunnerArgs = queueRunner.calls.mostRecent().args[0];
queueRunnerArgs.queueableFns[0].fn('foo');
const runQueueArgs = runQueue.calls.mostRecent().args[0];
runQueueArgs.queueableFns[0].fn('foo');
expect(leaf.execute).toHaveBeenCalledWith(
queueRunner,
runQueue,
globalErrors,
'foo',
false,
@@ -312,7 +312,7 @@ describe('TreeProcessor', function() {
detectLateRejectionHandling
);
queueRunnerArgs.onComplete();
runQueueArgs.onComplete();
await expectAsync(promise).toBeResolvedTo(undefined);
});
@@ -321,19 +321,19 @@ describe('TreeProcessor', function() {
root = new Node({ children: [node], userContext: { root: 'context' } }),
nodeStart = jasmine.createSpy('nodeStart'),
nodeComplete = jasmine.createSpy('nodeComplete'),
queueRunner = jasmine.createSpy('queueRunner'),
runQueue = jasmine.createSpy('runQueue'),
processor = new jasmineUnderTest.TreeProcessor({
tree: root,
runnableIds: [node.id],
nodeStart: nodeStart,
nodeComplete: nodeComplete,
queueRunnerFactory: queueRunner
runQueue
}),
nodeDone = jasmine.createSpy('nodeDone');
const promise = processor.execute();
expect(queueRunner).toHaveBeenCalledWith({
expect(runQueue).toHaveBeenCalledWith({
onComplete: jasmine.any(Function),
onException: jasmine.any(Function),
userContext: { root: 'context' },
@@ -341,9 +341,9 @@ describe('TreeProcessor', function() {
onMultipleDone: null
});
const queueRunnerArgs = queueRunner.calls.mostRecent().args[0];
queueRunnerArgs.queueableFns[0].fn(nodeDone);
expect(queueRunner).toHaveBeenCalledWith({
const runQueueArgs = runQueue.calls.mostRecent().args[0];
runQueueArgs.queueableFns[0].fn(nodeDone);
expect(runQueue).toHaveBeenCalledWith({
onComplete: jasmine.any(Function),
onMultipleDone: null,
queueableFns: [{ fn: jasmine.any(Function) }],
@@ -352,19 +352,19 @@ describe('TreeProcessor', function() {
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');
node.getResult.and.returnValue({ my: 'result' });
queueRunner.calls.mostRecent().args[0].onComplete();
runQueue.calls.mostRecent().args[0].onComplete();
expect(nodeComplete).toHaveBeenCalledWith(
node,
{ my: 'result' },
jasmine.any(Function)
);
queueRunnerArgs.onComplete();
runQueueArgs.onComplete();
await expectAsync(promise).toBeResolvedTo(undefined);
});
@@ -373,13 +373,13 @@ describe('TreeProcessor', function() {
const leaf2 = new Leaf();
const node = new Node({ children: [leaf1, leaf2] });
const root = new Node({ children: [node] });
const queueRunner = jasmine.createSpy('queueRunner');
const runQueue = jasmine.createSpy('runQueue');
const globalErrors = 'the globalErrors instance';
const detectLateRejectionHandling = false;
const processor = new jasmineUnderTest.TreeProcessor({
tree: root,
runnableIds: [node.id],
queueRunnerFactory: queueRunner,
runQueue,
globalErrors,
detectLateRejectionHandling
});
@@ -387,15 +387,15 @@ describe('TreeProcessor', function() {
const nodeDone = jasmine.createSpy('nodeDone');
processor.execute(treeComplete);
let queueableFns = queueRunner.calls.mostRecent().args[0].queueableFns;
let queueableFns = runQueue.calls.mostRecent().args[0].queueableFns;
queueableFns[0].fn(nodeDone);
queueableFns = queueRunner.calls.mostRecent().args[0].queueableFns;
queueableFns = runQueue.calls.mostRecent().args[0].queueableFns;
expect(queueableFns.length).toBe(3);
queueableFns[1].fn('foo');
expect(leaf1.execute).toHaveBeenCalledWith(
queueRunner,
runQueue,
globalErrors,
'foo',
false,
@@ -405,7 +405,7 @@ describe('TreeProcessor', function() {
queueableFns[2].fn('bar');
expect(leaf2.execute).toHaveBeenCalledWith(
queueRunner,
runQueue,
globalErrors,
'bar',
false,
@@ -418,7 +418,7 @@ describe('TreeProcessor', function() {
const leaf = new Leaf();
const node = new Node({ children: [leaf] });
const root = new Node({ children: [node] });
const queueRunner = jasmine.createSpy('queueRunner');
const runQueue = jasmine.createSpy('runQueue');
const globalErrors = 'the globalErrors instance';
const detectLateRejectionHandling = false;
const nodeComplete = jasmine.createSpy('nodeComplete');
@@ -426,7 +426,7 @@ describe('TreeProcessor', function() {
tree: root,
runnableIds: [node.id],
nodeComplete: nodeComplete,
queueRunnerFactory: queueRunner,
runQueue,
globalErrors,
detectLateRejectionHandling
});
@@ -434,15 +434,15 @@ describe('TreeProcessor', function() {
const nodeDone = jasmine.createSpy('nodeDone');
processor.execute(treeComplete);
let queueableFns = queueRunner.calls.mostRecent().args[0].queueableFns;
let queueableFns = runQueue.calls.mostRecent().args[0].queueableFns;
queueableFns[0].fn(nodeDone);
queueableFns = queueRunner.calls.mostRecent().args[0].queueableFns;
queueableFns = runQueue.calls.mostRecent().args[0].queueableFns;
expect(queueableFns.length).toBe(2);
queueableFns[1].fn('foo');
expect(leaf.execute).toHaveBeenCalledWith(
queueRunner,
runQueue,
globalErrors,
'foo',
false,
@@ -450,7 +450,7 @@ describe('TreeProcessor', function() {
detectLateRejectionHandling
);
queueRunner.calls.mostRecent().args[0].onComplete('things');
runQueue.calls.mostRecent().args[0].onComplete('things');
expect(nodeComplete).toHaveBeenCalled();
nodeComplete.calls.mostRecent().args[2]();
expect(nodeDone).toHaveBeenCalledWith('things');
@@ -460,7 +460,7 @@ describe('TreeProcessor', function() {
const leaf1 = new Leaf();
const node = new Node({ children: [leaf1] });
const root = new Node({ children: [node] });
const queueRunner = jasmine.createSpy('queueRunner');
const runQueue = jasmine.createSpy('runQueue');
const globalErrors = 'the globalErrors instance';
const detectLateRejectionHandling = false;
const nodeStart = jasmine.createSpy('nodeStart');
@@ -468,7 +468,7 @@ describe('TreeProcessor', function() {
const processor = new jasmineUnderTest.TreeProcessor({
tree: root,
runnableIds: [],
queueRunnerFactory: queueRunner,
runQueue,
nodeStart: nodeStart,
nodeComplete: nodeComplete,
globalErrors,
@@ -478,10 +478,10 @@ describe('TreeProcessor', function() {
const nodeDone = jasmine.createSpy('nodeDone');
processor.execute(treeComplete);
let queueableFns = queueRunner.calls.mostRecent().args[0].queueableFns;
let queueableFns = runQueue.calls.mostRecent().args[0].queueableFns;
queueableFns[0].fn(nodeDone);
queueableFns = queueRunner.calls.mostRecent().args[0].queueableFns;
queueableFns = runQueue.calls.mostRecent().args[0].queueableFns;
expect(queueableFns.length).toBe(2);
queueableFns[0].fn('bar');
@@ -489,7 +489,7 @@ describe('TreeProcessor', function() {
queueableFns[1].fn('foo');
expect(leaf1.execute).toHaveBeenCalledWith(
queueRunner,
runQueue,
globalErrors,
'foo',
true,
@@ -499,7 +499,7 @@ describe('TreeProcessor', function() {
node.getResult.and.returnValue({ im: 'disabled' });
queueRunner.calls.mostRecent().args[0].onComplete();
runQueue.calls.mostRecent().args[0].onComplete();
expect(nodeComplete).toHaveBeenCalledWith(
node,
{ im: 'disabled' },
@@ -511,7 +511,7 @@ describe('TreeProcessor', function() {
const leaf = new Leaf();
const node = new Node({ children: [leaf] });
const root = new Node({ children: [node] });
const queueRunner = jasmine.createSpy('queueRunner');
const runQueue = jasmine.createSpy('runQueue');
const globalErrors = 'the globalErrors instance';
const detectLateRejectionHandling = false;
const nodeStart = jasmine.createSpy('nodeStart');
@@ -519,7 +519,7 @@ describe('TreeProcessor', function() {
const processor = new jasmineUnderTest.TreeProcessor({
tree: root,
runnableIds: [],
queueRunnerFactory: queueRunner,
runQueue,
nodeStart: nodeStart,
nodeComplete: nodeComplete,
globalErrors,
@@ -530,15 +530,15 @@ describe('TreeProcessor', function() {
const nodeDone = jasmine.createSpy('nodeDone');
processor.execute(treeComplete);
let queueableFns = queueRunner.calls.mostRecent().args[0].queueableFns;
let queueableFns = runQueue.calls.mostRecent().args[0].queueableFns;
queueableFns[0].fn(nodeDone);
queueableFns = queueRunner.calls.mostRecent().args[0].queueableFns;
queueableFns = runQueue.calls.mostRecent().args[0].queueableFns;
expect(queueableFns.length).toBe(2);
queueableFns[1].fn('foo');
expect(leaf.execute).toHaveBeenCalledWith(
queueRunner,
runQueue,
globalErrors,
'foo',
true,
@@ -557,20 +557,20 @@ describe('TreeProcessor', function() {
]
}),
root = new Node({ children: [node] }),
queueRunner = jasmine.createSpy('queueRunner'),
runQueue = jasmine.createSpy('runQueue'),
processor = new jasmineUnderTest.TreeProcessor({
tree: root,
runnableIds: [node.id],
queueRunnerFactory: queueRunner
runQueue
}),
treeComplete = jasmine.createSpy('treeComplete'),
nodeDone = jasmine.createSpy('nodeDone');
processor.execute(treeComplete);
let queueableFns = queueRunner.calls.mostRecent().args[0].queueableFns;
let queueableFns = runQueue.calls.mostRecent().args[0].queueableFns;
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) },
@@ -588,20 +588,20 @@ describe('TreeProcessor', function() {
afterAllFns
}),
root = new Node({ children: [node] }),
queueRunner = jasmine.createSpy('queueRunner'),
runQueue = jasmine.createSpy('runQueue'),
processor = new jasmineUnderTest.TreeProcessor({
tree: root,
runnableIds: [node.id],
queueRunnerFactory: queueRunner
runQueue
}),
treeComplete = jasmine.createSpy('treeComplete'),
nodeDone = jasmine.createSpy('nodeDone');
processor.execute(treeComplete);
let queueableFns = queueRunner.calls.mostRecent().args[0].queueableFns;
let queueableFns = runQueue.calls.mostRecent().args[0].queueableFns;
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) },
@@ -617,20 +617,20 @@ describe('TreeProcessor', function() {
afterAllFns: [{ fn: 'after' }]
}),
root = new Node({ children: [node] }),
queueRunner = jasmine.createSpy('queueRunner'),
runQueue = jasmine.createSpy('runQueue'),
processor = new jasmineUnderTest.TreeProcessor({
tree: root,
runnableIds: [node.id],
queueRunnerFactory: queueRunner
runQueue
}),
treeComplete = jasmine.createSpy('treeComplete'),
nodeDone = jasmine.createSpy('nodeDone');
processor.execute(treeComplete);
let queueableFns = queueRunner.calls.mostRecent().args[0].queueableFns;
let queueableFns = runQueue.calls.mostRecent().args[0].queueableFns;
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) }]);
});
@@ -644,20 +644,20 @@ describe('TreeProcessor', function() {
markedPending: false
}),
root = new Node({ children: [node] }),
queueRunner = jasmine.createSpy('queueRunner'),
runQueue = jasmine.createSpy('runQueue'),
processor = new jasmineUnderTest.TreeProcessor({
tree: root,
runnableIds: [node.id],
queueRunnerFactory: queueRunner
runQueue
}),
treeComplete = jasmine.createSpy('treeComplete'),
nodeDone = jasmine.createSpy('nodeDone');
processor.execute(treeComplete);
let queueableFns = queueRunner.calls.mostRecent().args[0].queueableFns;
let queueableFns = runQueue.calls.mostRecent().args[0].queueableFns;
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) },
@@ -669,16 +669,16 @@ describe('TreeProcessor', function() {
const leaf1 = new Leaf(),
leaf2 = new Leaf(),
root = new Node({ children: [leaf1, leaf2] }),
queueRunner = jasmine.createSpy('queueRunner'),
runQueue = jasmine.createSpy('runQueue'),
processor = new jasmineUnderTest.TreeProcessor({
tree: root,
runnableIds: [leaf2.id, leaf1.id],
queueRunnerFactory: queueRunner
runQueue
}),
treeComplete = jasmine.createSpy('treeComplete');
processor.execute(treeComplete);
const queueableFns = queueRunner.calls.mostRecent().args[0].queueableFns;
const queueableFns = runQueue.calls.mostRecent().args[0].queueableFns;
queueableFns[0].fn();
expect(leaf1.execute).not.toHaveBeenCalled();
@@ -693,25 +693,25 @@ describe('TreeProcessor', function() {
const specified = new Leaf();
const nonSpecified = new Leaf();
const root = new Node({ children: [nonSpecified, specified] });
const queueRunner = jasmine.createSpy('queueRunner');
const runQueue = jasmine.createSpy('runQueue');
const globalErrors = 'the globalErrors instance';
const detectLateRejectionHandling = false;
const processor = new jasmineUnderTest.TreeProcessor({
tree: root,
runnableIds: [specified.id],
queueRunnerFactory: queueRunner,
runQueue,
globalErrors,
detectLateRejectionHandling
});
const treeComplete = jasmine.createSpy('treeComplete');
processor.execute(treeComplete);
const queueableFns = queueRunner.calls.mostRecent().args[0].queueableFns;
const queueableFns = runQueue.calls.mostRecent().args[0].queueableFns;
queueableFns[0].fn();
expect(nonSpecified.execute).not.toHaveBeenCalled();
expect(specified.execute).toHaveBeenCalledWith(
queueRunner,
runQueue,
globalErrors,
undefined,
false,
@@ -722,7 +722,7 @@ describe('TreeProcessor', function() {
queueableFns[1].fn();
expect(nonSpecified.execute).toHaveBeenCalledWith(
queueRunner,
runQueue,
globalErrors,
undefined,
true,
@@ -736,20 +736,19 @@ describe('TreeProcessor', function() {
childLeaf = new Leaf(),
specifiedNode = new Node({ children: [childLeaf] }),
root = new Node({ children: [specifiedLeaf, specifiedNode] }),
queueRunner = jasmine.createSpy('queueRunner'),
runQueue = jasmine.createSpy('runQueue'),
processor = new jasmineUnderTest.TreeProcessor({
tree: root,
runnableIds: [specifiedNode.id, specifiedLeaf.id],
queueRunnerFactory: queueRunner
runQueue
});
processor.execute();
const queueableFns = queueRunner.calls.mostRecent().args[0].queueableFns;
const queueableFns = runQueue.calls.mostRecent().args[0].queueableFns;
queueableFns[0].fn();
expect(specifiedLeaf.execute).not.toHaveBeenCalled();
const nodeQueueableFns = queueRunner.calls.mostRecent().args[0]
.queueableFns;
const nodeQueueableFns = runQueue.calls.mostRecent().args[0].queueableFns;
nodeQueueableFns[1].fn();
expect(childLeaf.execute).toHaveBeenCalled();
@@ -767,38 +766,38 @@ describe('TreeProcessor', function() {
leaf5 = new Leaf(),
reentered = new Node({ children: [leaf1, leaf2, leaf3] }),
root = new Node({ children: [reentered, leaf4, leaf5] }),
queueRunner = jasmine.createSpy('queueRunner'),
runQueue = jasmine.createSpy('runQueue'),
processor = new jasmineUnderTest.TreeProcessor({
tree: root,
runnableIds: [leaf1.id, leaf4.id, leaf2.id, leaf5.id, leaf3.id],
queueRunnerFactory: queueRunner
runQueue
});
processor.execute();
const queueableFns = queueRunner.calls.mostRecent().args[0].queueableFns;
const queueableFns = runQueue.calls.mostRecent().args[0].queueableFns;
expect(queueableFns.length).toBe(5);
queueableFns[0].fn();
expect(queueRunner.calls.mostRecent().args[0].queueableFns.length).toBe(2);
queueRunner.calls.mostRecent().args[0].queueableFns[1].fn();
expect(runQueue.calls.mostRecent().args[0].queueableFns.length).toBe(2);
runQueue.calls.mostRecent().args[0].queueableFns[1].fn();
expect(leaf1.execute).toHaveBeenCalled();
queueableFns[1].fn();
expect(leaf4.execute).toHaveBeenCalled();
queueableFns[2].fn();
expect(queueRunner.calls.count()).toBe(3);
expect(queueRunner.calls.mostRecent().args[0].queueableFns.length).toBe(2);
queueRunner.calls.mostRecent().args[0].queueableFns[1].fn();
expect(runQueue.calls.count()).toBe(3);
expect(runQueue.calls.mostRecent().args[0].queueableFns.length).toBe(2);
runQueue.calls.mostRecent().args[0].queueableFns[1].fn();
expect(leaf2.execute).toHaveBeenCalled();
queueableFns[3].fn();
expect(leaf5.execute).toHaveBeenCalled();
queueableFns[4].fn();
expect(queueRunner.calls.count()).toBe(4);
expect(queueRunner.calls.mostRecent().args[0].queueableFns.length).toBe(2);
queueRunner.calls.mostRecent().args[0].queueableFns[1].fn();
expect(runQueue.calls.count()).toBe(4);
expect(runQueue.calls.mostRecent().args[0].queueableFns.length).toBe(2);
runQueue.calls.mostRecent().args[0].queueableFns[1].fn();
expect(leaf3.execute).toHaveBeenCalled();
});
@@ -811,51 +810,51 @@ describe('TreeProcessor', function() {
parent = new Node({ children: [leaf1, leaf2, leaf3] }),
grandparent = new Node({ children: [parent] }),
root = new Node({ children: [grandparent, leaf4, leaf5] }),
queueRunner = jasmine.createSpy('queueRunner'),
runQueue = jasmine.createSpy('runQueue'),
processor = new jasmineUnderTest.TreeProcessor({
tree: root,
runnableIds: [leaf1.id, leaf4.id, leaf2.id, leaf5.id, leaf3.id],
queueRunnerFactory: queueRunner
runQueue
});
processor.execute();
const queueableFns = queueRunner.calls.mostRecent().args[0].queueableFns;
const queueableFns = runQueue.calls.mostRecent().args[0].queueableFns;
expect(queueableFns.length).toBe(5);
queueableFns[0].fn();
expect(queueRunner.calls.count()).toBe(2);
expect(queueRunner.calls.mostRecent().args[0].queueableFns.length).toBe(2);
expect(runQueue.calls.count()).toBe(2);
expect(runQueue.calls.mostRecent().args[0].queueableFns.length).toBe(2);
queueRunner.calls.mostRecent().args[0].queueableFns[1].fn();
expect(queueRunner.calls.count()).toBe(3);
runQueue.calls.mostRecent().args[0].queueableFns[1].fn();
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();
queueableFns[1].fn();
expect(leaf4.execute).toHaveBeenCalled();
queueableFns[2].fn();
expect(queueRunner.calls.count()).toBe(4);
expect(queueRunner.calls.mostRecent().args[0].queueableFns.length).toBe(2);
expect(runQueue.calls.count()).toBe(4);
expect(runQueue.calls.mostRecent().args[0].queueableFns.length).toBe(2);
queueRunner.calls.mostRecent().args[0].queueableFns[1].fn();
expect(queueRunner.calls.count()).toBe(5);
runQueue.calls.mostRecent().args[0].queueableFns[1].fn();
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();
queueableFns[3].fn();
expect(leaf5.execute).toHaveBeenCalled();
queueableFns[4].fn();
expect(queueRunner.calls.count()).toBe(6);
expect(queueRunner.calls.mostRecent().args[0].queueableFns.length).toBe(2);
expect(runQueue.calls.count()).toBe(6);
expect(runQueue.calls.mostRecent().args[0].queueableFns.length).toBe(2);
queueRunner.calls.mostRecent().args[0].queueableFns[1].fn();
expect(queueRunner.calls.count()).toBe(7);
runQueue.calls.mostRecent().args[0].queueableFns[1].fn();
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();
});
@@ -865,15 +864,15 @@ describe('TreeProcessor', function() {
leaf3 = new Leaf(),
parent = new Node({ children: [leaf2, leaf3] }),
root = new Node({ children: [leaf1, parent] }),
queueRunner = jasmine.createSpy('queueRunner'),
runQueue = jasmine.createSpy('runQueue'),
processor = new jasmineUnderTest.TreeProcessor({
tree: root,
runnableIds: [root.id],
queueRunnerFactory: queueRunner
runQueue
});
processor.execute();
const queueableFns = queueRunner.calls.mostRecent().args[0].queueableFns;
const queueableFns = runQueue.calls.mostRecent().args[0].queueableFns;
expect(queueableFns.length).toBe(2);
queueableFns[0].fn();
@@ -881,7 +880,7 @@ describe('TreeProcessor', function() {
queueableFns[1].fn();
const childFns = queueRunner.calls.mostRecent().args[0].queueableFns;
const childFns = runQueue.calls.mostRecent().args[0].queueableFns;
expect(childFns.length).toBe(3);
childFns[1].fn();
expect(leaf2.execute).toHaveBeenCalled();
@@ -917,15 +916,15 @@ describe('TreeProcessor', function() {
leaf11
]
}),
queueRunner = jasmine.createSpy('queueRunner'),
runQueue = jasmine.createSpy('runQueue'),
processor = new jasmineUnderTest.TreeProcessor({
tree: root,
runnableIds: [root.id],
queueRunnerFactory: queueRunner
runQueue
});
processor.execute();
const queueableFns = queueRunner.calls.mostRecent().args[0].queueableFns;
const queueableFns = runQueue.calls.mostRecent().args[0].queueableFns;
expect(queueableFns.length).toBe(11);
queueableFns[0].fn();
@@ -989,11 +988,11 @@ describe('TreeProcessor', function() {
leaf11
]
}),
queueRunner = jasmine.createSpy('queueRunner'),
runQueue = jasmine.createSpy('runQueue'),
processor = new jasmineUnderTest.TreeProcessor({
tree: root,
runnableIds: [root.id],
queueRunnerFactory: queueRunner,
runQueue,
orderChildren: function(node) {
const children = node.children.slice();
return children.reverse();
@@ -1001,7 +1000,7 @@ describe('TreeProcessor', function() {
});
processor.execute();
const queueableFns = queueRunner.calls.mostRecent().args[0].queueableFns;
const queueableFns = runQueue.calls.mostRecent().args[0].queueableFns;
expect(queueableFns.length).toBe(11);
queueableFns[0].fn();

View File

@@ -455,7 +455,7 @@ getJasmineRequireObj().Env = function(j$) {
deprecator.addDeprecationWarning(runable, deprecation, options);
};
function queueRunnerFactory(options) {
function runQueue(options) {
options.clearStack = options.clearStack || clearStack;
options.timeout = {
setTimeout: realSetTimeout,
@@ -479,7 +479,7 @@ getJasmineRequireObj().Env = function(j$) {
onLateError: recordLateError,
specResultCallback,
specStarted,
queueRunnerFactory
runQueue
});
topSuite = suiteBuilder.topSuite;
const deprecator = new j$.Deprecator(topSuite);
@@ -506,7 +506,7 @@ getJasmineRequireObj().Env = function(j$) {
j$.reporterEvents,
function(options) {
options.SkipPolicy = j$.NeverSkipPolicy;
return queueRunnerFactory(options);
return runQueue(options);
},
recordLateError
);
@@ -517,7 +517,7 @@ getJasmineRequireObj().Env = function(j$) {
focusedRunables: () => suiteBuilder.focusedRunables,
runableResources,
reporter,
queueRunnerFactory,
runQueue,
TreeProcessor: j$.TreeProcessor,
globalErrors,
getConfig: () => config,

View File

@@ -1,7 +1,7 @@
getJasmineRequireObj().ReportDispatcher = function(j$) {
'use strict';
function ReportDispatcher(methods, queueRunnerFactory, onLateError) {
function ReportDispatcher(methods, runQueue, onLateError) {
const dispatchedMethods = methods || [];
for (const method of dispatchedMethods) {
@@ -39,7 +39,7 @@ getJasmineRequireObj().ReportDispatcher = function(j$) {
}
return new Promise(function(resolve) {
queueRunnerFactory({
runQueue({
queueableFns: fns,
onComplete: resolve,
isReporter: true,

View File

@@ -6,7 +6,7 @@ getJasmineRequireObj().Runner = function(j$) {
this.totalSpecsDefined_ = options.totalSpecsDefined;
this.focusedRunables_ = options.focusedRunables;
this.runableResources_ = options.runableResources;
this.queueRunnerFactory_ = options.queueRunnerFactory;
this.runQueue_ = options.runQueue;
this.TreeProcessor_ = options.TreeProcessor;
this.globalErrors_ = options.globalErrors;
this.reporter_ = options.reporter;
@@ -59,7 +59,7 @@ getJasmineRequireObj().Runner = function(j$) {
const processor = new this.TreeProcessor_({
tree: this.topSuite_,
runnableIds: runablesToRun,
queueRunnerFactory: options => {
runQueue: options => {
if (options.isLeaf) {
// A spec
options.SkipPolicy = j$.CompleteOnFirstErrorSkipPolicy;
@@ -72,7 +72,7 @@ getJasmineRequireObj().Runner = function(j$) {
}
}
return this.queueRunnerFactory_(options);
return this.runQueue_(options);
},
globalErrors: this.globalErrors_,
failSpecWithNoExpectations: config.failSpecWithNoExpectations,

View File

@@ -72,7 +72,7 @@ getJasmineRequireObj().Spec = function(j$) {
};
Spec.prototype.execute = function(
queueRunnerFactory,
runQueue,
globalErrors,
onComplete,
excluded,
@@ -155,7 +155,7 @@ getJasmineRequireObj().Spec = function(j$) {
}
runnerConfig.queueableFns.push(complete);
queueRunnerFactory(runnerConfig);
runQueue(runnerConfig);
};
Spec.prototype.reset = function() {

View File

@@ -2,7 +2,7 @@ getJasmineRequireObj().TreeProcessor = function() {
function TreeProcessor(attrs) {
const tree = attrs.tree;
const runnableIds = attrs.runnableIds;
const queueRunnerFactory = attrs.queueRunnerFactory;
const runQueue = attrs.runQueue;
const nodeStart = attrs.nodeStart || function() {};
const nodeComplete = attrs.nodeComplete || function() {};
const failSpecWithNoExpectations = !!attrs.failSpecWithNoExpectations;
@@ -42,7 +42,7 @@ getJasmineRequireObj().TreeProcessor = function() {
const childFns = wrapChildren(tree, 0);
await new Promise(function(resolve) {
queueRunnerFactory({
runQueue({
queueableFns: childFns,
userContext: tree.sharedUserContext(),
onException: function() {
@@ -212,7 +212,7 @@ getJasmineRequireObj().TreeProcessor = function() {
}
};
queueRunnerFactory({
runQueue({
onComplete: function() {
const args = Array.prototype.slice.call(arguments, [0]);
node.cleanupBeforeAfter();
@@ -235,7 +235,7 @@ getJasmineRequireObj().TreeProcessor = function() {
return {
fn: function(done) {
node.execute(
queueRunnerFactory,
runQueue,
globalErrors,
done,
stats[node.id].excluded,