From 1e8619df8862a806d19b9be160617f04d11f2327 Mon Sep 17 00:00:00 2001 From: Steve Gravrock Date: Wed, 12 Feb 2020 15:59:38 -0800 Subject: [PATCH] Removed deprecated env methods --- lib/jasmine-core/jasmine.js | 119 --------------------- spec/core/integration/SpecRunningSpec.js | 129 ----------------------- src/core/Env.js | 119 --------------------- 3 files changed, 367 deletions(-) diff --git a/lib/jasmine-core/jasmine.js b/lib/jasmine-core/jasmine.js index 76f91002..3b644f9a 100644 --- a/lib/jasmine-core/jasmine.js +++ b/lib/jasmine-core/jasmine.js @@ -1217,21 +1217,6 @@ getJasmineRequireObj().Env = function(j$) { return result; }; - Object.defineProperty(this, 'specFilter', { - get: function() { - self.deprecated( - 'Getting specFilter directly from Env is deprecated and will be removed in a future version of Jasmine, please check the specFilter option from `configuration`' - ); - return config.specFilter; - }, - set: function(val) { - self.deprecated( - 'Setting specFilter directly on Env is deprecated and will be removed in a future version of Jasmine, please use the specFilter option in `configure`' - ); - config.specFilter = val; - } - }); - this.setDefaultSpyStrategy = function(defaultStrategyFn) { if (!currentRunnable()) { throw new Error( @@ -1468,110 +1453,6 @@ getJasmineRequireObj().Env = function(j$) { return buildExpectationResult(attrs); }; - /** - * Sets whether Jasmine should throw an Error when an expectation fails. - * This causes a spec to only have one expectation failure. - * @name Env#throwOnExpectationFailure - * @since 2.3.0 - * @function - * @param {Boolean} value Whether to throw when a expectation fails - * @deprecated Use the `oneFailurePerSpec` option with {@link Env#configure} - */ - this.throwOnExpectationFailure = function(value) { - this.deprecated( - 'Setting throwOnExpectationFailure directly on Env is deprecated and will be removed in a future version of Jasmine, please use the oneFailurePerSpec option in `configure`' - ); - this.configure({ oneFailurePerSpec: !!value }); - }; - - this.throwingExpectationFailures = function() { - this.deprecated( - 'Getting throwingExpectationFailures directly from Env is deprecated and will be removed in a future version of Jasmine, please check the oneFailurePerSpec option from `configuration`' - ); - return config.oneFailurePerSpec; - }; - - /** - * Set whether to stop suite execution when a spec fails - * @name Env#stopOnSpecFailure - * @since 2.7.0 - * @function - * @param {Boolean} value Whether to stop suite execution when a spec fails - * @deprecated Use the `failFast` option with {@link Env#configure} - */ - this.stopOnSpecFailure = function(value) { - this.deprecated( - 'Setting stopOnSpecFailure directly is deprecated and will be removed in a future version of Jasmine, please use the failFast option in `configure`' - ); - this.configure({ failFast: !!value }); - }; - - this.stoppingOnSpecFailure = function() { - this.deprecated( - 'Getting stoppingOnSpecFailure directly from Env is deprecated and will be removed in a future version of Jasmine, please check the failFast option from `configuration`' - ); - return config.failFast; - }; - - /** - * Set whether to randomize test execution order - * @name Env#randomizeTests - * @since 2.4.0 - * @function - * @param {Boolean} value Whether to randomize execution order - * @deprecated Use the `random` option with {@link Env#configure} - */ - this.randomizeTests = function(value) { - this.deprecated( - 'Setting randomizeTests directly is deprecated and will be removed in a future version of Jasmine, please use the random option in `configure`' - ); - config.random = !!value; - }; - - this.randomTests = function() { - this.deprecated( - 'Getting randomTests directly from Env is deprecated and will be removed in a future version of Jasmine, please check the random option from `configuration`' - ); - return config.random; - }; - - /** - * Set the random number seed for spec randomization - * @name Env#seed - * @since 2.4.0 - * @function - * @param {Number} value The seed value - * @deprecated Use the `seed` option with {@link Env#configure} - */ - this.seed = function(value) { - this.deprecated( - 'Setting seed directly is deprecated and will be removed in a future version of Jasmine, please use the seed option in `configure`' - ); - if (value) { - config.seed = value; - } - return config.seed; - }; - - this.hidingDisabled = function(value) { - this.deprecated( - 'Getting hidingDisabled directly from Env is deprecated and will be removed in a future version of Jasmine, please check the hideDisabled option from `configuration`' - ); - return config.hideDisabled; - }; - - /** - * @name Env#hideDisabled - * @since 3.2.0 - * @function - */ - this.hideDisabled = function(value) { - this.deprecated( - 'Setting hideDisabled directly is deprecated and will be removed in a future version of Jasmine, please use the hideDisabled option in `configure`' - ); - config.hideDisabled = !!value; - }; - this.deprecated = function(deprecation) { var runnable = currentRunnable() || topSuite; var context; diff --git a/spec/core/integration/SpecRunningSpec.js b/spec/core/integration/SpecRunningSpec.js index d6e26104..31cae08c 100644 --- a/spec/core/integration/SpecRunningSpec.js +++ b/spec/core/integration/SpecRunningSpec.js @@ -877,107 +877,6 @@ describe('spec running', function() { done(); }); }); - - it('skips to cleanup functions after an error with deprecations', function(done) { - var actions = []; - - spyOn(env, 'deprecated'); - - env.describe('Something', function() { - env.beforeEach(function() { - actions.push('outer beforeEach'); - throw new Error('error'); - }); - - env.afterEach(function() { - actions.push('outer afterEach'); - }); - - env.describe('Inner', function() { - env.beforeEach(function() { - actions.push('inner beforeEach'); - }); - - env.afterEach(function() { - actions.push('inner afterEach'); - }); - - env.it('does it', function() { - actions.push('inner it'); - }); - }); - }); - - env.throwOnExpectationFailure(true); - - env.execute(null, function() { - expect(actions).toEqual([ - 'outer beforeEach', - 'inner afterEach', - 'outer afterEach' - ]); - expect(env.deprecated).toHaveBeenCalled(); - done(); - }); - }); - - it('skips to cleanup functions after done.fail is called with deprecations', function(done) { - var actions = []; - - spyOn(env, 'deprecated'); - - env.describe('Something', function() { - env.beforeEach(function(done) { - actions.push('beforeEach'); - done.fail('error'); - actions.push('after done.fail'); - }); - - env.afterEach(function() { - actions.push('afterEach'); - }); - - env.it('does it', function() { - actions.push('it'); - }); - }); - - env.throwOnExpectationFailure(true); - - env.execute(null, function() { - expect(actions).toEqual(['beforeEach', 'afterEach']); - expect(env.deprecated).toHaveBeenCalled(); - done(); - }); - }); - - it('skips to cleanup functions when an async function times out with deprecations', function(done) { - var actions = []; - - spyOn(env, 'deprecated'); - - env.describe('Something', function() { - env.beforeEach(function(innerDone) { - actions.push('beforeEach'); - }, 1); - - env.afterEach(function() { - actions.push('afterEach'); - }); - - env.it('does it', function() { - actions.push('it'); - }); - }); - - env.throwOnExpectationFailure(true); - - env.execute(null, function() { - expect(actions).toEqual(['beforeEach', 'afterEach']); - expect(env.deprecated).toHaveBeenCalled(); - done(); - }); - }); }); describe('when stopOnSpecFailure is on', function() { @@ -1004,33 +903,5 @@ describe('spec running', function() { done(); }); }); - - it('does not run further specs when one fails when configured with deprecated option', function(done) { - var actions = []; - - spyOn(env, 'deprecated'); - - env.describe('wrapper', function() { - env.it('fails', function() { - actions.push('fails'); - env.expect(1).toBe(2); - }); - }); - - env.describe('holder', function() { - env.it('does not run', function() { - actions.push('does not run'); - }); - }); - - env.configure({ random: false }); - env.stopOnSpecFailure(true); - - env.execute(null, function() { - expect(actions).toEqual(['fails']); - expect(env.deprecated).toHaveBeenCalled(); - done(); - }); - }); }); }); diff --git a/src/core/Env.js b/src/core/Env.js index b0193d15..138711e0 100644 --- a/src/core/Env.js +++ b/src/core/Env.js @@ -246,21 +246,6 @@ getJasmineRequireObj().Env = function(j$) { return result; }; - Object.defineProperty(this, 'specFilter', { - get: function() { - self.deprecated( - 'Getting specFilter directly from Env is deprecated and will be removed in a future version of Jasmine, please check the specFilter option from `configuration`' - ); - return config.specFilter; - }, - set: function(val) { - self.deprecated( - 'Setting specFilter directly on Env is deprecated and will be removed in a future version of Jasmine, please use the specFilter option in `configure`' - ); - config.specFilter = val; - } - }); - this.setDefaultSpyStrategy = function(defaultStrategyFn) { if (!currentRunnable()) { throw new Error( @@ -497,110 +482,6 @@ getJasmineRequireObj().Env = function(j$) { return buildExpectationResult(attrs); }; - /** - * Sets whether Jasmine should throw an Error when an expectation fails. - * This causes a spec to only have one expectation failure. - * @name Env#throwOnExpectationFailure - * @since 2.3.0 - * @function - * @param {Boolean} value Whether to throw when a expectation fails - * @deprecated Use the `oneFailurePerSpec` option with {@link Env#configure} - */ - this.throwOnExpectationFailure = function(value) { - this.deprecated( - 'Setting throwOnExpectationFailure directly on Env is deprecated and will be removed in a future version of Jasmine, please use the oneFailurePerSpec option in `configure`' - ); - this.configure({ oneFailurePerSpec: !!value }); - }; - - this.throwingExpectationFailures = function() { - this.deprecated( - 'Getting throwingExpectationFailures directly from Env is deprecated and will be removed in a future version of Jasmine, please check the oneFailurePerSpec option from `configuration`' - ); - return config.oneFailurePerSpec; - }; - - /** - * Set whether to stop suite execution when a spec fails - * @name Env#stopOnSpecFailure - * @since 2.7.0 - * @function - * @param {Boolean} value Whether to stop suite execution when a spec fails - * @deprecated Use the `failFast` option with {@link Env#configure} - */ - this.stopOnSpecFailure = function(value) { - this.deprecated( - 'Setting stopOnSpecFailure directly is deprecated and will be removed in a future version of Jasmine, please use the failFast option in `configure`' - ); - this.configure({ failFast: !!value }); - }; - - this.stoppingOnSpecFailure = function() { - this.deprecated( - 'Getting stoppingOnSpecFailure directly from Env is deprecated and will be removed in a future version of Jasmine, please check the failFast option from `configuration`' - ); - return config.failFast; - }; - - /** - * Set whether to randomize test execution order - * @name Env#randomizeTests - * @since 2.4.0 - * @function - * @param {Boolean} value Whether to randomize execution order - * @deprecated Use the `random` option with {@link Env#configure} - */ - this.randomizeTests = function(value) { - this.deprecated( - 'Setting randomizeTests directly is deprecated and will be removed in a future version of Jasmine, please use the random option in `configure`' - ); - config.random = !!value; - }; - - this.randomTests = function() { - this.deprecated( - 'Getting randomTests directly from Env is deprecated and will be removed in a future version of Jasmine, please check the random option from `configuration`' - ); - return config.random; - }; - - /** - * Set the random number seed for spec randomization - * @name Env#seed - * @since 2.4.0 - * @function - * @param {Number} value The seed value - * @deprecated Use the `seed` option with {@link Env#configure} - */ - this.seed = function(value) { - this.deprecated( - 'Setting seed directly is deprecated and will be removed in a future version of Jasmine, please use the seed option in `configure`' - ); - if (value) { - config.seed = value; - } - return config.seed; - }; - - this.hidingDisabled = function(value) { - this.deprecated( - 'Getting hidingDisabled directly from Env is deprecated and will be removed in a future version of Jasmine, please check the hideDisabled option from `configuration`' - ); - return config.hideDisabled; - }; - - /** - * @name Env#hideDisabled - * @since 3.2.0 - * @function - */ - this.hideDisabled = function(value) { - this.deprecated( - 'Setting hideDisabled directly is deprecated and will be removed in a future version of Jasmine, please use the hideDisabled option in `configure`' - ); - config.hideDisabled = !!value; - }; - this.deprecated = function(deprecation) { var runnable = currentRunnable() || topSuite; var context;