Don't remove before and after fns from the top suite

This commit is contained in:
Steve Gravrock
2025-09-02 10:23:44 -07:00
parent 3698f6fb5d
commit 6665c4e123
3 changed files with 49 additions and 2 deletions

View File

@@ -209,7 +209,6 @@ getJasmineRequireObj().TreeRunner = function(j$) {
}
#suiteSegmentComplete(suite, result, next) {
suite.cleanupBeforeAfter();
const isTopSuite = suite === this.#executionTree.topSuite;
if (!isTopSuite) {
@@ -217,6 +216,11 @@ getJasmineRequireObj().TreeRunner = function(j$) {
throw new Error('Tried to complete the wrong suite');
}
// suite.cleanupBeforeAfter() is conditional because calling it on the
// top suite breaks parallel mode. The top suite is reentered every time
// a runner runs another file, so its before and after fns need to be
// preserved.
suite.cleanupBeforeAfter();
this.#runableResources.clearForRunable(suite.id);
this.#currentRunableTracker.popSuite();