From 62b5698a990e91393ee03152eea5df0a1ef6c954 Mon Sep 17 00:00:00 2001 From: Steve Gravrock Date: Sat, 6 Sep 2025 09:42:39 -0700 Subject: [PATCH] Clean up TreeRunner onComplete callback --- lib/jasmine-core/jasmine.js | 9 +++------ src/core/TreeRunner.js | 9 +++------ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/lib/jasmine-core/jasmine.js b/lib/jasmine-core/jasmine.js index 10e4d900..eeb857f1 100644 --- a/lib/jasmine-core/jasmine.js +++ b/lib/jasmine-core/jasmine.js @@ -11584,14 +11584,11 @@ getJasmineRequireObj().TreeRunner = function(j$) { } this.#runQueue({ - // 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]); + onComplete: maybeError => { this.#suiteSegmentComplete(suite, suite.getResult(), () => { - done.apply(undefined, args); + done(maybeError); }); - }.bind(this), + }, queueableFns, userContext: suite.sharedUserContext(), onException: function() { diff --git a/src/core/TreeRunner.js b/src/core/TreeRunner.js index 1a84a59a..8b7c5703 100644 --- a/src/core/TreeRunner.js +++ b/src/core/TreeRunner.js @@ -162,14 +162,11 @@ getJasmineRequireObj().TreeRunner = function(j$) { } this.#runQueue({ - // 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]); + onComplete: maybeError => { this.#suiteSegmentComplete(suite, suite.getResult(), () => { - done.apply(undefined, args); + done(maybeError); }); - }.bind(this), + }, queueableFns, userContext: suite.sharedUserContext(), onException: function() {