Deprecated the failFast and oneFailurePerSpec config properties
This commit is contained in:
@@ -1251,6 +1251,18 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
});
|
||||
|
||||
if (typeof configuration.failFast !== 'undefined') {
|
||||
// We can't unconditionally issue a warning here because then users who
|
||||
// get the configuration from Jasmine, modify it, and pass it back would
|
||||
// see the warning.
|
||||
if (configuration.failFast !== config.failFast) {
|
||||
this.deprecated(
|
||||
'The `failFast` config property is deprecated and will be removed ' +
|
||||
'in a future version of Jasmine. Please use `stopOnSpecFailure` ' +
|
||||
'instead.',
|
||||
{ ignoreRunnable: true }
|
||||
);
|
||||
}
|
||||
|
||||
if (typeof configuration.stopOnSpecFailure !== 'undefined') {
|
||||
if (configuration.stopOnSpecFailure !== configuration.failFast) {
|
||||
throw new Error(
|
||||
@@ -1268,6 +1280,18 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
}
|
||||
|
||||
if (typeof configuration.oneFailurePerSpec !== 'undefined') {
|
||||
// We can't unconditionally issue a warning here because then users who
|
||||
// get the configuration from Jasmine, modify it, and pass it back would
|
||||
// see the warning.
|
||||
if (configuration.oneFailurePerSpec !== config.oneFailurePerSpec) {
|
||||
this.deprecated(
|
||||
'The `oneFailurePerSpec` config property is deprecated and will be ' +
|
||||
'removed in a future version of Jasmine. Please use ' +
|
||||
'`stopSpecOnExpectationFailure` instead.',
|
||||
{ ignoreRunnable: true }
|
||||
);
|
||||
}
|
||||
|
||||
if (typeof configuration.stopSpecOnExpectationFailure !== 'undefined') {
|
||||
if (
|
||||
configuration.stopSpecOnExpectationFailure !==
|
||||
|
||||
@@ -256,7 +256,7 @@ describe('Env', function() {
|
||||
});
|
||||
|
||||
it('can configure specs to throw errors on expectation failures', function() {
|
||||
env.configure({ oneFailurePerSpec: true });
|
||||
env.configure({ stopSpecOnExpectationFailure: true });
|
||||
|
||||
spyOn(jasmineUnderTest, 'Spec');
|
||||
env.it('foo', function() {});
|
||||
@@ -268,7 +268,7 @@ describe('Env', function() {
|
||||
});
|
||||
|
||||
it('can configure suites to throw errors on expectation failures', function() {
|
||||
env.configure({ oneFailurePerSpec: true });
|
||||
env.configure({ stopSpecOnExpectationFailure: true });
|
||||
|
||||
spyOn(jasmineUnderTest, 'Suite');
|
||||
env.describe('foo', function() {});
|
||||
@@ -280,6 +280,7 @@ describe('Env', function() {
|
||||
});
|
||||
|
||||
it('ignores configuration properties that are present but undefined', function() {
|
||||
spyOn(env, 'deprecated');
|
||||
var initialConfig = {
|
||||
random: true,
|
||||
seed: '123',
|
||||
@@ -309,6 +310,7 @@ describe('Env', function() {
|
||||
});
|
||||
|
||||
it('sets stopOnSpecFailure when failFast is set, and vice versa', function() {
|
||||
spyOn(env, 'deprecated');
|
||||
env.configure({ failFast: true });
|
||||
expect(env.configuration()).toEqual(
|
||||
jasmine.objectContaining({
|
||||
@@ -327,6 +329,7 @@ describe('Env', function() {
|
||||
});
|
||||
|
||||
it('rejects a single call that sets stopOnSpecFailure and failFast to different values', function() {
|
||||
spyOn(env, 'deprecated');
|
||||
expect(function() {
|
||||
env.configure({ failFast: true, stopOnSpecFailure: false });
|
||||
}).toThrowError(
|
||||
@@ -335,7 +338,18 @@ describe('Env', function() {
|
||||
);
|
||||
});
|
||||
|
||||
it('deprecates the failFast config property', function() {
|
||||
spyOn(env, 'deprecated');
|
||||
env.configure({ failFast: true });
|
||||
expect(env.deprecated).toHaveBeenCalledWith(
|
||||
'The `failFast` config property is deprecated and will be removed in a ' +
|
||||
'future version of Jasmine. Please use `stopOnSpecFailure` instead.',
|
||||
{ ignoreRunnable: true }
|
||||
);
|
||||
});
|
||||
|
||||
it('sets stopSpecOnExpectationFailure when oneFailurePerSpec is set, and vice versa', function() {
|
||||
spyOn(env, 'deprecated');
|
||||
env.configure({ oneFailurePerSpec: true });
|
||||
expect(env.configuration()).toEqual(
|
||||
jasmine.objectContaining({
|
||||
@@ -354,6 +368,7 @@ describe('Env', function() {
|
||||
});
|
||||
|
||||
it('rejects a single call that sets stopSpecOnExpectationFailure and oneFailurePerSpec to different values', function() {
|
||||
spyOn(env, 'deprecated');
|
||||
expect(function() {
|
||||
env.configure({
|
||||
oneFailurePerSpec: true,
|
||||
@@ -366,6 +381,17 @@ describe('Env', function() {
|
||||
);
|
||||
});
|
||||
|
||||
it('deprecates the oneFailurePerSpec config property', function() {
|
||||
spyOn(env, 'deprecated');
|
||||
env.configure({ oneFailurePerSpec: true });
|
||||
expect(env.deprecated).toHaveBeenCalledWith(
|
||||
'The `oneFailurePerSpec` config property is deprecated and will be ' +
|
||||
'removed in a future version of Jasmine. Please use ' +
|
||||
'`stopSpecOnExpectationFailure` instead.',
|
||||
{ ignoreRunnable: true }
|
||||
);
|
||||
});
|
||||
|
||||
describe('promise library', function() {
|
||||
it('can be configured without a custom library', function() {
|
||||
env.configure({});
|
||||
|
||||
@@ -792,7 +792,7 @@ describe('spec running', function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe('When throwOnExpectationFailure is set', function() {
|
||||
describe('When stopSpecOnExpectationFailure is set', function() {
|
||||
it('skips to cleanup functions after an error', function(done) {
|
||||
var actions = [];
|
||||
|
||||
@@ -821,7 +821,7 @@ describe('spec running', function() {
|
||||
});
|
||||
});
|
||||
|
||||
env.configure({ oneFailurePerSpec: true });
|
||||
env.configure({ stopSpecOnExpectationFailure: true });
|
||||
|
||||
env.execute(null, function() {
|
||||
expect(actions).toEqual([
|
||||
@@ -852,7 +852,7 @@ describe('spec running', function() {
|
||||
});
|
||||
});
|
||||
|
||||
env.configure({ oneFailurePerSpec: true });
|
||||
env.configure({ stopSpecOnExpectationFailure: true });
|
||||
|
||||
env.execute(null, function() {
|
||||
expect(actions).toEqual(['beforeEach', 'afterEach']);
|
||||
@@ -877,7 +877,7 @@ describe('spec running', function() {
|
||||
});
|
||||
});
|
||||
|
||||
env.configure({ oneFailurePerSpec: true });
|
||||
env.configure({ stopSpecOnExpectationFailure: true });
|
||||
|
||||
env.execute(null, function() {
|
||||
expect(actions).toEqual(['beforeEach', 'afterEach']);
|
||||
@@ -1017,6 +1017,7 @@ describe('spec running', function() {
|
||||
|
||||
describe('when failFast is on', function() {
|
||||
behavesLikeStopOnSpecFailureIsOn(function(env) {
|
||||
spyOn(env, 'deprecated');
|
||||
env.configure({ failFast: true });
|
||||
});
|
||||
});
|
||||
|
||||
@@ -213,6 +213,18 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
});
|
||||
|
||||
if (typeof configuration.failFast !== 'undefined') {
|
||||
// We can't unconditionally issue a warning here because then users who
|
||||
// get the configuration from Jasmine, modify it, and pass it back would
|
||||
// see the warning.
|
||||
if (configuration.failFast !== config.failFast) {
|
||||
this.deprecated(
|
||||
'The `failFast` config property is deprecated and will be removed ' +
|
||||
'in a future version of Jasmine. Please use `stopOnSpecFailure` ' +
|
||||
'instead.',
|
||||
{ ignoreRunnable: true }
|
||||
);
|
||||
}
|
||||
|
||||
if (typeof configuration.stopOnSpecFailure !== 'undefined') {
|
||||
if (configuration.stopOnSpecFailure !== configuration.failFast) {
|
||||
throw new Error(
|
||||
@@ -230,6 +242,18 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
}
|
||||
|
||||
if (typeof configuration.oneFailurePerSpec !== 'undefined') {
|
||||
// We can't unconditionally issue a warning here because then users who
|
||||
// get the configuration from Jasmine, modify it, and pass it back would
|
||||
// see the warning.
|
||||
if (configuration.oneFailurePerSpec !== config.oneFailurePerSpec) {
|
||||
this.deprecated(
|
||||
'The `oneFailurePerSpec` config property is deprecated and will be ' +
|
||||
'removed in a future version of Jasmine. Please use ' +
|
||||
'`stopSpecOnExpectationFailure` instead.',
|
||||
{ ignoreRunnable: true }
|
||||
);
|
||||
}
|
||||
|
||||
if (typeof configuration.stopSpecOnExpectationFailure !== 'undefined') {
|
||||
if (
|
||||
configuration.stopSpecOnExpectationFailure !==
|
||||
|
||||
Reference in New Issue
Block a user