Unify top suite and regular suite execution
This commit is contained in:
@@ -11445,34 +11445,9 @@ getJasmineRequireObj().TreeRunner = function(j$) {
|
|||||||
|
|
||||||
async execute() {
|
async execute() {
|
||||||
this.#hasFailures = false;
|
this.#hasFailures = false;
|
||||||
const topSuite = this.#executionTree.topSuite;
|
|
||||||
const wrappedChildren = this.#wrapNodes(
|
|
||||||
this.#executionTree.childrenOfTopSuite()
|
|
||||||
);
|
|
||||||
const queueableFns = this.#addBeforeAndAfterAlls(
|
|
||||||
topSuite,
|
|
||||||
wrappedChildren
|
|
||||||
);
|
|
||||||
|
|
||||||
await new Promise(resolve => {
|
await new Promise(resolve => {
|
||||||
this.#runQueue({
|
this.#executeSuiteSegment(this.#executionTree.topSuite, 0, resolve);
|
||||||
queueableFns,
|
|
||||||
userContext: this.#executionTree.topSuite.sharedUserContext(),
|
|
||||||
onException: function() {
|
|
||||||
topSuite.handleException.apply(topSuite, arguments);
|
|
||||||
}.bind(this),
|
|
||||||
onComplete: resolve,
|
|
||||||
onMultipleDone: topSuite.onMultipleDone
|
|
||||||
? topSuite.onMultipleDone.bind(topSuite)
|
|
||||||
: null,
|
|
||||||
SkipPolicy: this.#suiteSkipPolicy()
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (topSuite.hadBeforeAllFailure) {
|
|
||||||
await this.#reportChildrenOfBeforeAllFailure(topSuite);
|
|
||||||
}
|
|
||||||
|
|
||||||
return { hasFailures: this.#hasFailures };
|
return { hasFailures: this.#hasFailures };
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -11584,18 +11559,20 @@ getJasmineRequireObj().TreeRunner = function(j$) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#executeSuiteSegment(suite, segmentNumber, done) {
|
#executeSuiteSegment(suite, segmentNumber, done) {
|
||||||
const wrappedChildren = this.#wrapNodes(
|
const isTopSuite = suite === this.#executionTree.topSuite;
|
||||||
this.#executionTree.childrenOfSuiteSegment(suite, segmentNumber)
|
const children = isTopSuite
|
||||||
);
|
? this.#executionTree.childrenOfTopSuite()
|
||||||
const onStart = {
|
: this.#executionTree.childrenOfSuiteSegment(suite, segmentNumber);
|
||||||
fn: next => {
|
const wrappedChildren = this.#wrapNodes(children);
|
||||||
this.#suiteSegmentStart(suite, next);
|
const queueableFns = this.#addBeforeAndAfterAlls(suite, wrappedChildren);
|
||||||
}
|
|
||||||
};
|
if (!isTopSuite) {
|
||||||
const queueableFns = [
|
queueableFns.unshift({
|
||||||
onStart,
|
fn: next => {
|
||||||
...this.#addBeforeAndAfterAlls(suite, wrappedChildren)
|
this.#suiteSegmentStart(suite, next);
|
||||||
];
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
this.#runQueue({
|
this.#runQueue({
|
||||||
// TODO: if onComplete always takes 0-1 arguments (and it probably does)
|
// TODO: if onComplete always takes 0-1 arguments (and it probably does)
|
||||||
@@ -11627,25 +11604,30 @@ getJasmineRequireObj().TreeRunner = function(j$) {
|
|||||||
|
|
||||||
#suiteSegmentComplete(suite, result, next) {
|
#suiteSegmentComplete(suite, result, next) {
|
||||||
suite.cleanupBeforeAfter();
|
suite.cleanupBeforeAfter();
|
||||||
|
const isTopSuite = suite === this.#executionTree.topSuite;
|
||||||
|
|
||||||
if (suite !== this.#currentRunableTracker.currentSuite()) {
|
if (!isTopSuite) {
|
||||||
throw new Error('Tried to complete the wrong suite');
|
if (suite !== this.#currentRunableTracker.currentSuite()) {
|
||||||
|
throw new Error('Tried to complete the wrong suite');
|
||||||
|
}
|
||||||
|
|
||||||
|
this.#runableResources.clearForRunable(suite.id);
|
||||||
|
this.#currentRunableTracker.popSuite();
|
||||||
|
|
||||||
|
if (result.status === 'failed') {
|
||||||
|
this.#hasFailures = true;
|
||||||
|
}
|
||||||
|
suite.endTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.#runableResources.clearForRunable(suite.id);
|
const finish = isTopSuite
|
||||||
this.#currentRunableTracker.popSuite();
|
? next
|
||||||
|
: () => this.#reportSuiteDone(suite, result, next);
|
||||||
if (result.status === 'failed') {
|
|
||||||
this.#hasFailures = true;
|
|
||||||
}
|
|
||||||
suite.endTimer();
|
|
||||||
|
|
||||||
if (suite.hadBeforeAllFailure) {
|
if (suite.hadBeforeAllFailure) {
|
||||||
this.#reportChildrenOfBeforeAllFailure(suite).then(() => {
|
this.#reportChildrenOfBeforeAllFailure(suite).then(finish);
|
||||||
this.#reportSuiteDone(suite, result, next);
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
this.#reportSuiteDone(suite, result, next);
|
finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,34 +23,9 @@ getJasmineRequireObj().TreeRunner = function(j$) {
|
|||||||
|
|
||||||
async execute() {
|
async execute() {
|
||||||
this.#hasFailures = false;
|
this.#hasFailures = false;
|
||||||
const topSuite = this.#executionTree.topSuite;
|
|
||||||
const wrappedChildren = this.#wrapNodes(
|
|
||||||
this.#executionTree.childrenOfTopSuite()
|
|
||||||
);
|
|
||||||
const queueableFns = this.#addBeforeAndAfterAlls(
|
|
||||||
topSuite,
|
|
||||||
wrappedChildren
|
|
||||||
);
|
|
||||||
|
|
||||||
await new Promise(resolve => {
|
await new Promise(resolve => {
|
||||||
this.#runQueue({
|
this.#executeSuiteSegment(this.#executionTree.topSuite, 0, resolve);
|
||||||
queueableFns,
|
|
||||||
userContext: this.#executionTree.topSuite.sharedUserContext(),
|
|
||||||
onException: function() {
|
|
||||||
topSuite.handleException.apply(topSuite, arguments);
|
|
||||||
}.bind(this),
|
|
||||||
onComplete: resolve,
|
|
||||||
onMultipleDone: topSuite.onMultipleDone
|
|
||||||
? topSuite.onMultipleDone.bind(topSuite)
|
|
||||||
: null,
|
|
||||||
SkipPolicy: this.#suiteSkipPolicy()
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (topSuite.hadBeforeAllFailure) {
|
|
||||||
await this.#reportChildrenOfBeforeAllFailure(topSuite);
|
|
||||||
}
|
|
||||||
|
|
||||||
return { hasFailures: this.#hasFailures };
|
return { hasFailures: this.#hasFailures };
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,18 +137,20 @@ getJasmineRequireObj().TreeRunner = function(j$) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#executeSuiteSegment(suite, segmentNumber, done) {
|
#executeSuiteSegment(suite, segmentNumber, done) {
|
||||||
const wrappedChildren = this.#wrapNodes(
|
const isTopSuite = suite === this.#executionTree.topSuite;
|
||||||
this.#executionTree.childrenOfSuiteSegment(suite, segmentNumber)
|
const children = isTopSuite
|
||||||
);
|
? this.#executionTree.childrenOfTopSuite()
|
||||||
const onStart = {
|
: this.#executionTree.childrenOfSuiteSegment(suite, segmentNumber);
|
||||||
fn: next => {
|
const wrappedChildren = this.#wrapNodes(children);
|
||||||
this.#suiteSegmentStart(suite, next);
|
const queueableFns = this.#addBeforeAndAfterAlls(suite, wrappedChildren);
|
||||||
}
|
|
||||||
};
|
if (!isTopSuite) {
|
||||||
const queueableFns = [
|
queueableFns.unshift({
|
||||||
onStart,
|
fn: next => {
|
||||||
...this.#addBeforeAndAfterAlls(suite, wrappedChildren)
|
this.#suiteSegmentStart(suite, next);
|
||||||
];
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
this.#runQueue({
|
this.#runQueue({
|
||||||
// TODO: if onComplete always takes 0-1 arguments (and it probably does)
|
// TODO: if onComplete always takes 0-1 arguments (and it probably does)
|
||||||
@@ -205,25 +182,30 @@ getJasmineRequireObj().TreeRunner = function(j$) {
|
|||||||
|
|
||||||
#suiteSegmentComplete(suite, result, next) {
|
#suiteSegmentComplete(suite, result, next) {
|
||||||
suite.cleanupBeforeAfter();
|
suite.cleanupBeforeAfter();
|
||||||
|
const isTopSuite = suite === this.#executionTree.topSuite;
|
||||||
|
|
||||||
if (suite !== this.#currentRunableTracker.currentSuite()) {
|
if (!isTopSuite) {
|
||||||
throw new Error('Tried to complete the wrong suite');
|
if (suite !== this.#currentRunableTracker.currentSuite()) {
|
||||||
|
throw new Error('Tried to complete the wrong suite');
|
||||||
|
}
|
||||||
|
|
||||||
|
this.#runableResources.clearForRunable(suite.id);
|
||||||
|
this.#currentRunableTracker.popSuite();
|
||||||
|
|
||||||
|
if (result.status === 'failed') {
|
||||||
|
this.#hasFailures = true;
|
||||||
|
}
|
||||||
|
suite.endTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.#runableResources.clearForRunable(suite.id);
|
const finish = isTopSuite
|
||||||
this.#currentRunableTracker.popSuite();
|
? next
|
||||||
|
: () => this.#reportSuiteDone(suite, result, next);
|
||||||
if (result.status === 'failed') {
|
|
||||||
this.#hasFailures = true;
|
|
||||||
}
|
|
||||||
suite.endTimer();
|
|
||||||
|
|
||||||
if (suite.hadBeforeAllFailure) {
|
if (suite.hadBeforeAllFailure) {
|
||||||
this.#reportChildrenOfBeforeAllFailure(suite).then(() => {
|
this.#reportChildrenOfBeforeAllFailure(suite).then(finish);
|
||||||
this.#reportSuiteDone(suite, result, next);
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
this.#reportSuiteDone(suite, result, next);
|
finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user