diff --git a/lib/jasmine-core/jasmine.js b/lib/jasmine-core/jasmine.js index 3e31d0cd..d4269af1 100644 --- a/lib/jasmine-core/jasmine.js +++ b/lib/jasmine-core/jasmine.js @@ -11584,7 +11584,7 @@ getJasmineRequireObj().TreeRunner = function(j$) { this.#reportDispatcher.specStarted(spec.result).then(next); }, (result, next) => { - this.#specComplete(spec, result, next); + this.#specComplete(spec).then(next); }, done, this.#executionTree.isExcluded(spec), @@ -11663,20 +11663,20 @@ getJasmineRequireObj().TreeRunner = function(j$) { this.#reportDispatcher.suiteDone(result).then(next); } - #specComplete(spec, result, next) { + async #specComplete(spec) { this.#runableResources.clearForRunable(spec.id); this.#currentRunableTracker.setCurrentSpec(null); - if (result.status === 'failed') { + if (spec.result.status === 'failed') { this.#hasFailures = true; } - this.#reportSpecDone(spec, result, next); + await this.#reportSpecDone(spec); } - #reportSpecDone(spec, result, next) { + async #reportSpecDone(spec) { spec.reportedDone = true; - this.#reportDispatcher.specDone(result).then(next); + await this.#reportDispatcher.specDone(spec.result); } #addBeforeAndAfterAlls(suite, wrappedChildren) { diff --git a/spec/core/TreeRunnerSpec.js b/spec/core/TreeRunnerSpec.js index cdb73863..17e6e3bc 100644 --- a/spec/core/TreeRunnerSpec.js +++ b/spec/core/TreeRunnerSpec.js @@ -112,6 +112,8 @@ describe('TreeRunner', function() { expect(spec.result.duration).toEqual('the elapsed time'); expect(spec.reportedDone).toEqual(true); await Promise.resolve(); + await Promise.resolve(); + await Promise.resolve(); expect(reportDispatcher.specDone).toHaveBeenCalledBefore(next); await expectAsync(promise).toBePending(); }); diff --git a/src/core/TreeRunner.js b/src/core/TreeRunner.js index cbac8868..d65b4fec 100644 --- a/src/core/TreeRunner.js +++ b/src/core/TreeRunner.js @@ -75,7 +75,7 @@ getJasmineRequireObj().TreeRunner = function(j$) { this.#reportDispatcher.specStarted(spec.result).then(next); }, (result, next) => { - this.#specComplete(spec, result, next); + this.#specComplete(spec).then(next); }, done, this.#executionTree.isExcluded(spec), @@ -154,20 +154,20 @@ getJasmineRequireObj().TreeRunner = function(j$) { this.#reportDispatcher.suiteDone(result).then(next); } - #specComplete(spec, result, next) { + async #specComplete(spec) { this.#runableResources.clearForRunable(spec.id); this.#currentRunableTracker.setCurrentSpec(null); - if (result.status === 'failed') { + if (spec.result.status === 'failed') { this.#hasFailures = true; } - this.#reportSpecDone(spec, result, next); + await this.#reportSpecDone(spec); } - #reportSpecDone(spec, result, next) { + async #reportSpecDone(spec) { spec.reportedDone = true; - this.#reportDispatcher.specDone(result).then(next); + await this.#reportDispatcher.specDone(spec.result); } #addBeforeAndAfterAlls(suite, wrappedChildren) {