Removed deprecated env methods
This commit is contained in:
committed by
Steve Gravrock
parent
4b2a14f1f3
commit
1e8619df88
@@ -1217,21 +1217,6 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
return result;
|
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) {
|
this.setDefaultSpyStrategy = function(defaultStrategyFn) {
|
||||||
if (!currentRunnable()) {
|
if (!currentRunnable()) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
@@ -1468,110 +1453,6 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
return buildExpectationResult(attrs);
|
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) {
|
this.deprecated = function(deprecation) {
|
||||||
var runnable = currentRunnable() || topSuite;
|
var runnable = currentRunnable() || topSuite;
|
||||||
var context;
|
var context;
|
||||||
|
|||||||
@@ -877,107 +877,6 @@ describe('spec running', function() {
|
|||||||
done();
|
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() {
|
describe('when stopOnSpecFailure is on', function() {
|
||||||
@@ -1004,33 +903,5 @@ describe('spec running', function() {
|
|||||||
done();
|
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();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
119
src/core/Env.js
119
src/core/Env.js
@@ -246,21 +246,6 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
return result;
|
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) {
|
this.setDefaultSpyStrategy = function(defaultStrategyFn) {
|
||||||
if (!currentRunnable()) {
|
if (!currentRunnable()) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
@@ -497,110 +482,6 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
return buildExpectationResult(attrs);
|
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) {
|
this.deprecated = function(deprecation) {
|
||||||
var runnable = currentRunnable() || topSuite;
|
var runnable = currentRunnable() || topSuite;
|
||||||
var context;
|
var context;
|
||||||
|
|||||||
Reference in New Issue
Block a user