Convert some TreeRunner internals to promises
This commit is contained in:
@@ -11584,7 +11584,7 @@ getJasmineRequireObj().TreeRunner = function(j$) {
|
|||||||
this.#reportDispatcher.specStarted(spec.result).then(next);
|
this.#reportDispatcher.specStarted(spec.result).then(next);
|
||||||
},
|
},
|
||||||
(result, next) => {
|
(result, next) => {
|
||||||
this.#specComplete(spec, result, next);
|
this.#specComplete(spec).then(next);
|
||||||
},
|
},
|
||||||
done,
|
done,
|
||||||
this.#executionTree.isExcluded(spec),
|
this.#executionTree.isExcluded(spec),
|
||||||
@@ -11663,20 +11663,20 @@ getJasmineRequireObj().TreeRunner = function(j$) {
|
|||||||
this.#reportDispatcher.suiteDone(result).then(next);
|
this.#reportDispatcher.suiteDone(result).then(next);
|
||||||
}
|
}
|
||||||
|
|
||||||
#specComplete(spec, result, next) {
|
async #specComplete(spec) {
|
||||||
this.#runableResources.clearForRunable(spec.id);
|
this.#runableResources.clearForRunable(spec.id);
|
||||||
this.#currentRunableTracker.setCurrentSpec(null);
|
this.#currentRunableTracker.setCurrentSpec(null);
|
||||||
|
|
||||||
if (result.status === 'failed') {
|
if (spec.result.status === 'failed') {
|
||||||
this.#hasFailures = true;
|
this.#hasFailures = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.#reportSpecDone(spec, result, next);
|
await this.#reportSpecDone(spec);
|
||||||
}
|
}
|
||||||
|
|
||||||
#reportSpecDone(spec, result, next) {
|
async #reportSpecDone(spec) {
|
||||||
spec.reportedDone = true;
|
spec.reportedDone = true;
|
||||||
this.#reportDispatcher.specDone(result).then(next);
|
await this.#reportDispatcher.specDone(spec.result);
|
||||||
}
|
}
|
||||||
|
|
||||||
#addBeforeAndAfterAlls(suite, wrappedChildren) {
|
#addBeforeAndAfterAlls(suite, wrappedChildren) {
|
||||||
|
|||||||
@@ -112,6 +112,8 @@ describe('TreeRunner', function() {
|
|||||||
expect(spec.result.duration).toEqual('the elapsed time');
|
expect(spec.result.duration).toEqual('the elapsed time');
|
||||||
expect(spec.reportedDone).toEqual(true);
|
expect(spec.reportedDone).toEqual(true);
|
||||||
await Promise.resolve();
|
await Promise.resolve();
|
||||||
|
await Promise.resolve();
|
||||||
|
await Promise.resolve();
|
||||||
expect(reportDispatcher.specDone).toHaveBeenCalledBefore(next);
|
expect(reportDispatcher.specDone).toHaveBeenCalledBefore(next);
|
||||||
await expectAsync(promise).toBePending();
|
await expectAsync(promise).toBePending();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ getJasmineRequireObj().TreeRunner = function(j$) {
|
|||||||
this.#reportDispatcher.specStarted(spec.result).then(next);
|
this.#reportDispatcher.specStarted(spec.result).then(next);
|
||||||
},
|
},
|
||||||
(result, next) => {
|
(result, next) => {
|
||||||
this.#specComplete(spec, result, next);
|
this.#specComplete(spec).then(next);
|
||||||
},
|
},
|
||||||
done,
|
done,
|
||||||
this.#executionTree.isExcluded(spec),
|
this.#executionTree.isExcluded(spec),
|
||||||
@@ -154,20 +154,20 @@ getJasmineRequireObj().TreeRunner = function(j$) {
|
|||||||
this.#reportDispatcher.suiteDone(result).then(next);
|
this.#reportDispatcher.suiteDone(result).then(next);
|
||||||
}
|
}
|
||||||
|
|
||||||
#specComplete(spec, result, next) {
|
async #specComplete(spec) {
|
||||||
this.#runableResources.clearForRunable(spec.id);
|
this.#runableResources.clearForRunable(spec.id);
|
||||||
this.#currentRunableTracker.setCurrentSpec(null);
|
this.#currentRunableTracker.setCurrentSpec(null);
|
||||||
|
|
||||||
if (result.status === 'failed') {
|
if (spec.result.status === 'failed') {
|
||||||
this.#hasFailures = true;
|
this.#hasFailures = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.#reportSpecDone(spec, result, next);
|
await this.#reportSpecDone(spec);
|
||||||
}
|
}
|
||||||
|
|
||||||
#reportSpecDone(spec, result, next) {
|
async #reportSpecDone(spec) {
|
||||||
spec.reportedDone = true;
|
spec.reportedDone = true;
|
||||||
this.#reportDispatcher.specDone(result).then(next);
|
await this.#reportDispatcher.specDone(spec.result);
|
||||||
}
|
}
|
||||||
|
|
||||||
#addBeforeAndAfterAlls(suite, wrappedChildren) {
|
#addBeforeAndAfterAlls(suite, wrappedChildren) {
|
||||||
|
|||||||
Reference in New Issue
Block a user