From 0bfbda720d1ffe855cf0d258e8484bcf6034c39c Mon Sep 17 00:00:00 2001 From: Steve Gravrock Date: Sun, 21 Aug 2022 16:35:12 -0700 Subject: [PATCH] Breaking change: Env#execute no longer takes a callback Use the returned promise instead. --- lib/jasmine-core/jasmine.js | 22 ++++------------------ spec/core/integration/EnvSpec.js | 10 ---------- src/core/Env.js | 22 ++++------------------ 3 files changed, 8 insertions(+), 46 deletions(-) diff --git a/lib/jasmine-core/jasmine.js b/lib/jasmine-core/jasmine.js index b210638f..5caa353a 100644 --- a/lib/jasmine-core/jasmine.js +++ b/lib/jasmine-core/jasmine.js @@ -1638,18 +1638,12 @@ getJasmineRequireObj().Env = function(j$) { /** * Executes the specs. * - * If called with no parameters or with a falsy value as the first parameter, + * If called with no parameter or with a falsy parameter, * all specs will be executed except those that are excluded by a * [spec filter]{@link Configuration#specFilter} or other mechanism. If the - * first parameter is a list of spec/suite IDs, only those specs/suites will + * parameter is a list of spec/suite IDs, only those specs/suites will * be run. * - * Both parameters are optional, but a completion callback is only valid as - * the second parameter. To specify a completion callback but not a list of - * specs/suites to run, pass null or undefined as the first parameter. The - * completion callback is supported for backward compatibility. In most - * cases it will be more convenient to use the returned promise instead. - * * execute should not be called more than once unless the env has been * configured with `{autoCleanClosures: false}`. * @@ -1663,19 +1657,11 @@ getJasmineRequireObj().Env = function(j$) { * @since 2.0.0 * @function * @param {(string[])=} runablesToRun IDs of suites and/or specs to run - * @param {Function=} onComplete Function that will be called after all specs have run * @return {Promise} */ - this.execute = function(runablesToRun, onComplete) { + this.execute = function(runablesToRun) { installGlobalErrors(); - - return runner.execute(runablesToRun).then(function(jasmineDoneInfo) { - if (onComplete) { - onComplete(); - } - - return jasmineDoneInfo; - }); + return runner.execute(runablesToRun); }; /** diff --git a/spec/core/integration/EnvSpec.js b/spec/core/integration/EnvSpec.js index bfaa8a51..65865d67 100644 --- a/spec/core/integration/EnvSpec.js +++ b/spec/core/integration/EnvSpec.js @@ -3670,16 +3670,6 @@ describe('Env integration', function() { expect(failedExpectations).toEqual([]); }); - it('calls the optional done callback when finished', function(done) { - const reporter = jasmine.createSpyObj('reporter', ['jasmineDone']); - env.addReporter(reporter); - - env.execute(null, function() { - expect(reporter.jasmineDone).toHaveBeenCalled(); - done(); - }); - }); - describe('#spyOnGlobalErrorsAsync', function() { const leftInstalledMessage = 'Global error spy was not uninstalled. ' + diff --git a/src/core/Env.js b/src/core/Env.js index 3233daf7..37be3ccc 100644 --- a/src/core/Env.js +++ b/src/core/Env.js @@ -496,18 +496,12 @@ getJasmineRequireObj().Env = function(j$) { /** * Executes the specs. * - * If called with no parameters or with a falsy value as the first parameter, + * If called with no parameter or with a falsy parameter, * all specs will be executed except those that are excluded by a * [spec filter]{@link Configuration#specFilter} or other mechanism. If the - * first parameter is a list of spec/suite IDs, only those specs/suites will + * parameter is a list of spec/suite IDs, only those specs/suites will * be run. * - * Both parameters are optional, but a completion callback is only valid as - * the second parameter. To specify a completion callback but not a list of - * specs/suites to run, pass null or undefined as the first parameter. The - * completion callback is supported for backward compatibility. In most - * cases it will be more convenient to use the returned promise instead. - * * execute should not be called more than once unless the env has been * configured with `{autoCleanClosures: false}`. * @@ -521,19 +515,11 @@ getJasmineRequireObj().Env = function(j$) { * @since 2.0.0 * @function * @param {(string[])=} runablesToRun IDs of suites and/or specs to run - * @param {Function=} onComplete Function that will be called after all specs have run * @return {Promise} */ - this.execute = function(runablesToRun, onComplete) { + this.execute = function(runablesToRun) { installGlobalErrors(); - - return runner.execute(runablesToRun).then(function(jasmineDoneInfo) { - if (onComplete) { - onComplete(); - } - - return jasmineDoneInfo; - }); + return runner.execute(runablesToRun); }; /**