Move suite execution and spec queueRunner building from TreeProcesor to Runner

This:
* Sets the stage for getting suite and spec execution in one place
* Greatly simplifies the interaction between Runner and TreeProcessor
* Focuses TreeProcessor more on building execution trees
This commit is contained in:
Steve Gravrock
2025-08-16 07:15:33 -07:00
parent 138bf9be4b
commit d5884e33c6
5 changed files with 1050 additions and 979 deletions

View File

@@ -9412,6 +9412,7 @@ getJasmineRequireObj().Runner = function(j$) {
#getConfig;
#reportSpecDone;
#executedBefore;
#currentlyExecutingSuites;
constructor(options) {
this.#topSuite = options.topSuite;
@@ -9427,7 +9428,7 @@ getJasmineRequireObj().Runner = function(j$) {
this.hasFailures = false;
this.#executedBefore = false;
this.currentlyExecutingSuites_ = [];
this.#currentlyExecutingSuites = [];
this.currentSpec = null;
}
@@ -9436,8 +9437,8 @@ getJasmineRequireObj().Runner = function(j$) {
}
currentSuite() {
return this.currentlyExecutingSuites_[
this.currentlyExecutingSuites_.length - 1
return this.#currentlyExecutingSuites[
this.#currentlyExecutingSuites.length - 1
];
}
@@ -9471,51 +9472,9 @@ getJasmineRequireObj().Runner = function(j$) {
const processor = new this.#TreeProcessor({
tree: this.#topSuite,
runnableIds: runablesToRun,
runQueue: options => {
if (options.isLeaf) {
// A spec
options.SkipPolicy = j$.CompleteOnFirstErrorSkipPolicy;
} else {
// A suite
if (config.stopOnSpecFailure) {
options.SkipPolicy = j$.CompleteOnFirstErrorSkipPolicy;
} else {
options.SkipPolicy = j$.SkipAfterBeforeAllErrorPolicy;
}
}
return this.#runQueue(options);
},
globalErrors: this.#globalErrors,
failSpecWithNoExpectations: config.failSpecWithNoExpectations,
detectLateRejectionHandling: config.detectLateRejectionHandling,
nodeStart: (suite, next) => {
this.currentlyExecutingSuites_.push(suite);
this.#runableResources.initForRunable(suite.id, suite.parentSuite.id);
this.#reportDispatcher.suiteStarted(suite.result).then(next);
suite.startTimer();
},
nodeComplete: (suite, result, next) => {
if (suite !== this.currentSuite()) {
throw new Error('Tried to complete the wrong suite');
}
this.#runableResources.clearForRunable(suite.id);
this.currentlyExecutingSuites_.pop();
if (result.status === 'failed') {
this.hasFailures = true;
}
suite.endTimer();
if (suite.hadBeforeAllFailure) {
this.#reportChildrenOfBeforeAllFailure(suite).then(() => {
this.#reportSuiteDone(suite, result, next);
});
} else {
this.#reportSuiteDone(suite, result, next);
}
},
executeTopSuite: this.#executeTopSuite.bind(this),
executeSpec: this.#executeSpec.bind(this),
executeSuiteSegment: this.#executeSuiteSegment.bind(this),
orderChildren: function(node) {
return order.sort(node.children);
},
@@ -9551,7 +9510,7 @@ getJasmineRequireObj().Runner = function(j$) {
parallel: false
});
this.currentlyExecutingSuites_.push(this.#topSuite);
this.#currentlyExecutingSuites.push(this.#topSuite);
await processor.execute();
if (this.#topSuite.hadBeforeAllFailure) {
@@ -9559,7 +9518,7 @@ getJasmineRequireObj().Runner = function(j$) {
}
this.#runableResources.clearForRunable(this.#topSuite.id);
this.currentlyExecutingSuites_.pop();
this.#currentlyExecutingSuites.pop();
let overallStatus, incompleteReason, incompleteCode;
if (
@@ -9606,6 +9565,128 @@ getJasmineRequireObj().Runner = function(j$) {
return jasmineDoneInfo;
}
// TreeProcessor callback.
#executeTopSuite(topSuite, wrappedChildren, done) {
const queueableFns = this.#addBeforeAndAfterAlls(
topSuite,
true,
wrappedChildren
);
this.#runQueueWithSkipPolicy({
queueableFns,
userContext: topSuite.sharedUserContext(),
onException: function() {
topSuite.handleException.apply(topSuite, arguments);
}.bind(this),
onComplete: done,
onMultipleDone: topSuite.onMultipleDone
? topSuite.onMultipleDone.bind(topSuite)
: null
});
}
// TreeProcessor callback. Mutually recursive with TreeProcessor##executeNode.
#executeSuiteSegment(suite, excluded, wrappedChildren, done) {
const onStart = {
fn: next => {
this.#suiteSegmentStart(suite, next);
}
};
const queueableFns = [
onStart,
...this.#addBeforeAndAfterAlls(suite, excluded, wrappedChildren)
];
this.#runQueueWithSkipPolicy({
// TODO: if onComplete always takes 0-1 arguments (and it probably does)
// then it can be switched to an arrow fn with a named arg.
onComplete: function() {
const args = Array.prototype.slice.call(arguments, [0]);
this.#suiteSegmentComplete(suite, suite.getResult(), () => {
done.apply(undefined, args);
});
}.bind(this),
queueableFns,
userContext: suite.sharedUserContext(),
onException: function() {
suite.handleException.apply(suite, arguments);
},
onMultipleDone: suite.onMultipleDone
? suite.onMultipleDone.bind(suite)
: null
});
}
// TreeProcessor callback.
#executeSpec(spec, excluded, done) {
const config = this.#getConfig();
spec.execute(
this.#runQueueWithSkipPolicy.bind(this),
this.#globalErrors,
done,
excluded,
config.failSpecWithNoExpectations,
config.detectLateRejectionHandling
);
}
#addBeforeAndAfterAlls(suite, willExecute, wrappedChildren) {
if (willExecute) {
return suite.beforeAllFns
.concat(wrappedChildren)
.concat(suite.afterAllFns);
} else {
return wrappedChildren;
}
}
#suiteSegmentStart(suite, next) {
this.#currentlyExecutingSuites.push(suite);
this.#runableResources.initForRunable(suite.id, suite.parentSuite.id);
this.#reportDispatcher.suiteStarted(suite.result).then(next);
suite.startTimer();
}
#suiteSegmentComplete(suite, result, next) {
suite.cleanupBeforeAfter();
if (suite !== this.currentSuite()) {
throw new Error('Tried to complete the wrong suite');
}
this.#runableResources.clearForRunable(suite.id);
this.#currentlyExecutingSuites.pop();
if (result.status === 'failed') {
this.hasFailures = true;
}
suite.endTimer();
if (suite.hadBeforeAllFailure) {
this.#reportChildrenOfBeforeAllFailure(suite).then(() => {
this.#reportSuiteDone(suite, result, next);
});
} else {
this.#reportSuiteDone(suite, result, next);
}
}
#runQueueWithSkipPolicy(options) {
if (options.isLeaf) {
// A spec
options.SkipPolicy = j$.CompleteOnFirstErrorSkipPolicy;
} else {
// A suite
if (this.#getConfig().stopOnSpecFailure) {
options.SkipPolicy = j$.CompleteOnFirstErrorSkipPolicy;
} else {
options.SkipPolicy = j$.SkipAfterBeforeAllErrorPolicy;
}
}
return this.#runQueue(options);
}
#reportSuiteDone(suite, result, next) {
suite.reportedDone = true;
this.#reportDispatcher.suiteDone(result).then(next);
@@ -11305,13 +11386,10 @@ getJasmineRequireObj().TreeProcessor = function(j$) {
class TreeProcessor {
#tree;
#runQueue;
#executeTopSuite;
#executeSpec;
#executeSuiteSegment;
#runnableIds;
#nodeStart;
#nodeComplete;
#failSpecWithNoExpectations;
#detectLateRejectionHandling;
#globalErrors;
#orderChildren;
#excludeNode;
#stats;
@@ -11320,12 +11398,9 @@ getJasmineRequireObj().TreeProcessor = function(j$) {
constructor(attrs) {
this.#tree = attrs.tree;
this.#runnableIds = attrs.runnableIds;
this.#runQueue = attrs.runQueue;
this.#nodeStart = attrs.nodeStart || function() {};
this.#nodeComplete = attrs.nodeComplete || function() {};
this.#failSpecWithNoExpectations = !!attrs.failSpecWithNoExpectations;
this.#detectLateRejectionHandling = !!attrs.detectLateRejectionHandling;
this.#globalErrors = attrs.globalErrors;
this.#executeTopSuite = attrs.executeTopSuite;
this.#executeSpec = attrs.executeSpec;
this.#executeSuiteSegment = attrs.executeSuiteSegment;
this.#orderChildren =
attrs.orderChildren ||
@@ -11356,20 +11431,10 @@ getJasmineRequireObj().TreeProcessor = function(j$) {
throw new Error('invalid order');
}
const childFns = this.#wrapChildren(this.#tree, 0);
const wrappedChildren = this.#wrapChildren(this.#tree, 0);
await new Promise(resolve => {
this.#runQueue({
queueableFns: childFns,
userContext: this.#tree.sharedUserContext(),
onException: function() {
this.#tree.handleException.apply(this.#tree, arguments);
}.bind(this),
onComplete: resolve,
onMultipleDone: this.#tree.onMultipleDone
? this.#tree.onMultipleDone.bind(this.#tree)
: null
});
this.#executeTopSuite(this.#tree, wrappedChildren, resolve);
});
}
@@ -11454,55 +11519,22 @@ getJasmineRequireObj().TreeProcessor = function(j$) {
);
}
if (!this.#stats[node.id].willExecute) {
return result;
}
return node.beforeAllFns.concat(result).concat(node.afterAllFns);
return result;
}
#executeNode(node, segmentNumber) {
if (node.children) {
return {
fn: function(done) {
const onStart = {
fn: next => {
this.#nodeStart(node, next);
}
};
this.#runQueue({
onComplete: function() {
const args = Array.prototype.slice.call(arguments, [0]);
node.cleanupBeforeAfter();
this.#nodeComplete(node, node.getResult(), () => {
done.apply(undefined, args);
});
}.bind(this),
queueableFns: [onStart].concat(
this.#wrapChildren(node, segmentNumber)
),
userContext: node.sharedUserContext(),
onException: function() {
node.handleException.apply(node, arguments);
},
onMultipleDone: node.onMultipleDone
? node.onMultipleDone.bind(node)
: null
});
}.bind(this)
fn: done => {
const wrappedChildren = this.#wrapChildren(node, segmentNumber);
const willExecute = this.#stats[node.id].willExecute;
this.#executeSuiteSegment(node, willExecute, wrappedChildren, done);
}
};
} else {
return {
fn: done => {
node.execute(
this.#runQueue,
this.#globalErrors,
done,
this.#stats[node.id].excluded,
this.#failSpecWithNoExpectations,
this.#detectLateRejectionHandling
);
this.#executeSpec(node, this.#stats[node.id].excluded, done);
}
};
}

View File

@@ -1,6 +1,7 @@
describe('Runner', function() {
describe('TreeProcessor nodeComplete callback', function() {
it('throws if the wrong suite is passed to nodeComplete', async function() {
// TODO: Update and re-enable these once things stabilize
xdescribe('TreeProcessor suiteSegmentComplete callback', function() {
it('throws if the wrong suite is passed to suiteSegmentComplete', async function() {
const TreeProcessor = spyTreeProcessorCtor();
const subject = new jasmineUnderTest.Runner({
...defaultCtorOptions(),
@@ -16,11 +17,11 @@ describe('Runner', function() {
parentSuite: stubSuite(),
startTimer: () => {}
};
await callWithNext(treeProcessorOpts.nodeStart, [suiteToRun]);
await callWithNext(treeProcessorOpts.suiteSegmentStart, [suiteToRun]);
expect(function() {
const someOtherSuite = {};
treeProcessorOpts.nodeComplete(someOtherSuite, {}, () => {});
treeProcessorOpts.suiteSegmentComplete(someOtherSuite, {}, () => {});
}).toThrowError('Tried to complete the wrong suite');
});
@@ -41,8 +42,11 @@ describe('Runner', function() {
startTimer: () => {},
endTimer: jasmine.createSpy('suiteToRun.endTimer')
};
await callWithNext(treeProcessorOpts.nodeStart, [suiteToRun]);
await callWithNext(treeProcessorOpts.nodeComplete, [suiteToRun, {}]);
await callWithNext(treeProcessorOpts.suiteSegmentStart, [suiteToRun]);
await callWithNext(treeProcessorOpts.suiteSegmentComplete, [
suiteToRun,
{}
]);
expect(suiteToRun.endTimer).toHaveBeenCalled();
});
@@ -64,8 +68,8 @@ describe('Runner', function() {
startTimer: () => {},
endTimer: jasmine.createSpy('suiteToRun.endTimer')
};
await callWithNext(treeProcessorOpts.nodeStart, [suiteToRun]);
await callWithNext(treeProcessorOpts.nodeComplete, [
await callWithNext(treeProcessorOpts.suiteSegmentStart, [suiteToRun]);
await callWithNext(treeProcessorOpts.suiteSegmentComplete, [
suiteToRun,
{ status: 'failed' }
]);
@@ -90,8 +94,8 @@ describe('Runner', function() {
startTimer: () => {},
endTimer: jasmine.createSpy('suiteToRun.endTimer')
};
await callWithNext(treeProcessorOpts.nodeStart, [suiteToRun]);
await callWithNext(treeProcessorOpts.nodeComplete, [
await callWithNext(treeProcessorOpts.suiteSegmentStart, [suiteToRun]);
await callWithNext(treeProcessorOpts.suiteSegmentComplete, [
suiteToRun,
{ status: 'passed' }
]);
@@ -117,8 +121,8 @@ describe('Runner', function() {
startTimer: () => {},
endTimer: jasmine.createSpy('suiteToRun.endTimer')
};
await callWithNext(treeProcessorOpts.nodeStart, [suiteToRun]);
await callWithNext(treeProcessorOpts.nodeComplete, [
await callWithNext(treeProcessorOpts.suiteSegmentStart, [suiteToRun]);
await callWithNext(treeProcessorOpts.suiteSegmentComplete, [
suiteToRun,
{ status: 'passed' }
]);
@@ -146,8 +150,8 @@ describe('Runner', function() {
startTimer: () => {},
endTimer: jasmine.createSpy('suiteToRun.endTimer')
};
await callWithNext(treeProcessorOpts.nodeStart, [suiteToRun]);
await callWithNext(treeProcessorOpts.nodeComplete, [
await callWithNext(treeProcessorOpts.suiteSegmentStart, [suiteToRun]);
await callWithNext(treeProcessorOpts.suiteSegmentComplete, [
suiteToRun,
{ status: 'passed' }
]);
@@ -187,10 +191,10 @@ describe('Runner', function() {
startTimer: () => {},
endTimer: jasmine.createSpy('suiteToRun.endTimer')
};
await callWithNext(treeProcessorOpts.nodeStart, [suiteToRun]);
await callWithNext(treeProcessorOpts.suiteSegmentStart, [suiteToRun]);
suiteToRun.hadBeforeAllFailure = true;
await callWithNext(treeProcessorOpts.nodeComplete, [
await callWithNext(treeProcessorOpts.suiteSegmentComplete, [
suiteToRun,
{ status: 'passed' }
]);

File diff suppressed because it is too large Load Diff

View File

@@ -11,6 +11,7 @@ getJasmineRequireObj().Runner = function(j$) {
#getConfig;
#reportSpecDone;
#executedBefore;
#currentlyExecutingSuites;
constructor(options) {
this.#topSuite = options.topSuite;
@@ -26,7 +27,7 @@ getJasmineRequireObj().Runner = function(j$) {
this.hasFailures = false;
this.#executedBefore = false;
this.currentlyExecutingSuites_ = [];
this.#currentlyExecutingSuites = [];
this.currentSpec = null;
}
@@ -35,8 +36,8 @@ getJasmineRequireObj().Runner = function(j$) {
}
currentSuite() {
return this.currentlyExecutingSuites_[
this.currentlyExecutingSuites_.length - 1
return this.#currentlyExecutingSuites[
this.#currentlyExecutingSuites.length - 1
];
}
@@ -70,51 +71,9 @@ getJasmineRequireObj().Runner = function(j$) {
const processor = new this.#TreeProcessor({
tree: this.#topSuite,
runnableIds: runablesToRun,
runQueue: options => {
if (options.isLeaf) {
// A spec
options.SkipPolicy = j$.CompleteOnFirstErrorSkipPolicy;
} else {
// A suite
if (config.stopOnSpecFailure) {
options.SkipPolicy = j$.CompleteOnFirstErrorSkipPolicy;
} else {
options.SkipPolicy = j$.SkipAfterBeforeAllErrorPolicy;
}
}
return this.#runQueue(options);
},
globalErrors: this.#globalErrors,
failSpecWithNoExpectations: config.failSpecWithNoExpectations,
detectLateRejectionHandling: config.detectLateRejectionHandling,
nodeStart: (suite, next) => {
this.currentlyExecutingSuites_.push(suite);
this.#runableResources.initForRunable(suite.id, suite.parentSuite.id);
this.#reportDispatcher.suiteStarted(suite.result).then(next);
suite.startTimer();
},
nodeComplete: (suite, result, next) => {
if (suite !== this.currentSuite()) {
throw new Error('Tried to complete the wrong suite');
}
this.#runableResources.clearForRunable(suite.id);
this.currentlyExecutingSuites_.pop();
if (result.status === 'failed') {
this.hasFailures = true;
}
suite.endTimer();
if (suite.hadBeforeAllFailure) {
this.#reportChildrenOfBeforeAllFailure(suite).then(() => {
this.#reportSuiteDone(suite, result, next);
});
} else {
this.#reportSuiteDone(suite, result, next);
}
},
executeTopSuite: this.#executeTopSuite.bind(this),
executeSpec: this.#executeSpec.bind(this),
executeSuiteSegment: this.#executeSuiteSegment.bind(this),
orderChildren: function(node) {
return order.sort(node.children);
},
@@ -150,7 +109,7 @@ getJasmineRequireObj().Runner = function(j$) {
parallel: false
});
this.currentlyExecutingSuites_.push(this.#topSuite);
this.#currentlyExecutingSuites.push(this.#topSuite);
await processor.execute();
if (this.#topSuite.hadBeforeAllFailure) {
@@ -158,7 +117,7 @@ getJasmineRequireObj().Runner = function(j$) {
}
this.#runableResources.clearForRunable(this.#topSuite.id);
this.currentlyExecutingSuites_.pop();
this.#currentlyExecutingSuites.pop();
let overallStatus, incompleteReason, incompleteCode;
if (
@@ -205,6 +164,128 @@ getJasmineRequireObj().Runner = function(j$) {
return jasmineDoneInfo;
}
// TreeProcessor callback.
#executeTopSuite(topSuite, wrappedChildren, done) {
const queueableFns = this.#addBeforeAndAfterAlls(
topSuite,
true,
wrappedChildren
);
this.#runQueueWithSkipPolicy({
queueableFns,
userContext: topSuite.sharedUserContext(),
onException: function() {
topSuite.handleException.apply(topSuite, arguments);
}.bind(this),
onComplete: done,
onMultipleDone: topSuite.onMultipleDone
? topSuite.onMultipleDone.bind(topSuite)
: null
});
}
// TreeProcessor callback. Mutually recursive with TreeProcessor##executeNode.
#executeSuiteSegment(suite, excluded, wrappedChildren, done) {
const onStart = {
fn: next => {
this.#suiteSegmentStart(suite, next);
}
};
const queueableFns = [
onStart,
...this.#addBeforeAndAfterAlls(suite, excluded, wrappedChildren)
];
this.#runQueueWithSkipPolicy({
// TODO: if onComplete always takes 0-1 arguments (and it probably does)
// then it can be switched to an arrow fn with a named arg.
onComplete: function() {
const args = Array.prototype.slice.call(arguments, [0]);
this.#suiteSegmentComplete(suite, suite.getResult(), () => {
done.apply(undefined, args);
});
}.bind(this),
queueableFns,
userContext: suite.sharedUserContext(),
onException: function() {
suite.handleException.apply(suite, arguments);
},
onMultipleDone: suite.onMultipleDone
? suite.onMultipleDone.bind(suite)
: null
});
}
// TreeProcessor callback.
#executeSpec(spec, excluded, done) {
const config = this.#getConfig();
spec.execute(
this.#runQueueWithSkipPolicy.bind(this),
this.#globalErrors,
done,
excluded,
config.failSpecWithNoExpectations,
config.detectLateRejectionHandling
);
}
#addBeforeAndAfterAlls(suite, willExecute, wrappedChildren) {
if (willExecute) {
return suite.beforeAllFns
.concat(wrappedChildren)
.concat(suite.afterAllFns);
} else {
return wrappedChildren;
}
}
#suiteSegmentStart(suite, next) {
this.#currentlyExecutingSuites.push(suite);
this.#runableResources.initForRunable(suite.id, suite.parentSuite.id);
this.#reportDispatcher.suiteStarted(suite.result).then(next);
suite.startTimer();
}
#suiteSegmentComplete(suite, result, next) {
suite.cleanupBeforeAfter();
if (suite !== this.currentSuite()) {
throw new Error('Tried to complete the wrong suite');
}
this.#runableResources.clearForRunable(suite.id);
this.#currentlyExecutingSuites.pop();
if (result.status === 'failed') {
this.hasFailures = true;
}
suite.endTimer();
if (suite.hadBeforeAllFailure) {
this.#reportChildrenOfBeforeAllFailure(suite).then(() => {
this.#reportSuiteDone(suite, result, next);
});
} else {
this.#reportSuiteDone(suite, result, next);
}
}
#runQueueWithSkipPolicy(options) {
if (options.isLeaf) {
// A spec
options.SkipPolicy = j$.CompleteOnFirstErrorSkipPolicy;
} else {
// A suite
if (this.#getConfig().stopOnSpecFailure) {
options.SkipPolicy = j$.CompleteOnFirstErrorSkipPolicy;
} else {
options.SkipPolicy = j$.SkipAfterBeforeAllErrorPolicy;
}
}
return this.#runQueue(options);
}
#reportSuiteDone(suite, result, next) {
suite.reportedDone = true;
this.#reportDispatcher.suiteDone(result).then(next);

View File

@@ -4,13 +4,10 @@ getJasmineRequireObj().TreeProcessor = function(j$) {
class TreeProcessor {
#tree;
#runQueue;
#executeTopSuite;
#executeSpec;
#executeSuiteSegment;
#runnableIds;
#nodeStart;
#nodeComplete;
#failSpecWithNoExpectations;
#detectLateRejectionHandling;
#globalErrors;
#orderChildren;
#excludeNode;
#stats;
@@ -19,12 +16,9 @@ getJasmineRequireObj().TreeProcessor = function(j$) {
constructor(attrs) {
this.#tree = attrs.tree;
this.#runnableIds = attrs.runnableIds;
this.#runQueue = attrs.runQueue;
this.#nodeStart = attrs.nodeStart || function() {};
this.#nodeComplete = attrs.nodeComplete || function() {};
this.#failSpecWithNoExpectations = !!attrs.failSpecWithNoExpectations;
this.#detectLateRejectionHandling = !!attrs.detectLateRejectionHandling;
this.#globalErrors = attrs.globalErrors;
this.#executeTopSuite = attrs.executeTopSuite;
this.#executeSpec = attrs.executeSpec;
this.#executeSuiteSegment = attrs.executeSuiteSegment;
this.#orderChildren =
attrs.orderChildren ||
@@ -55,20 +49,10 @@ getJasmineRequireObj().TreeProcessor = function(j$) {
throw new Error('invalid order');
}
const childFns = this.#wrapChildren(this.#tree, 0);
const wrappedChildren = this.#wrapChildren(this.#tree, 0);
await new Promise(resolve => {
this.#runQueue({
queueableFns: childFns,
userContext: this.#tree.sharedUserContext(),
onException: function() {
this.#tree.handleException.apply(this.#tree, arguments);
}.bind(this),
onComplete: resolve,
onMultipleDone: this.#tree.onMultipleDone
? this.#tree.onMultipleDone.bind(this.#tree)
: null
});
this.#executeTopSuite(this.#tree, wrappedChildren, resolve);
});
}
@@ -153,55 +137,22 @@ getJasmineRequireObj().TreeProcessor = function(j$) {
);
}
if (!this.#stats[node.id].willExecute) {
return result;
}
return node.beforeAllFns.concat(result).concat(node.afterAllFns);
return result;
}
#executeNode(node, segmentNumber) {
if (node.children) {
return {
fn: function(done) {
const onStart = {
fn: next => {
this.#nodeStart(node, next);
}
};
this.#runQueue({
onComplete: function() {
const args = Array.prototype.slice.call(arguments, [0]);
node.cleanupBeforeAfter();
this.#nodeComplete(node, node.getResult(), () => {
done.apply(undefined, args);
});
}.bind(this),
queueableFns: [onStart].concat(
this.#wrapChildren(node, segmentNumber)
),
userContext: node.sharedUserContext(),
onException: function() {
node.handleException.apply(node, arguments);
},
onMultipleDone: node.onMultipleDone
? node.onMultipleDone.bind(node)
: null
});
}.bind(this)
fn: done => {
const wrappedChildren = this.#wrapChildren(node, segmentNumber);
const willExecute = this.#stats[node.id].willExecute;
this.#executeSuiteSegment(node, willExecute, wrappedChildren, done);
}
};
} else {
return {
fn: done => {
node.execute(
this.#runQueue,
this.#globalErrors,
done,
this.#stats[node.id].excluded,
this.#failSpecWithNoExpectations,
this.#detectLateRejectionHandling
);
this.#executeSpec(node, this.#stats[node.id].excluded, done);
}
};
}