Removed the failFast and oneFailurePerSpec config properties

This commit is contained in:
Steve Gravrock
2021-07-31 09:23:52 -07:00
parent 2480a0a93a
commit d8862aa583
9 changed files with 35 additions and 286 deletions

View File

@@ -27,8 +27,8 @@
var filterSpecs = !!queryString.getParam("spec");
var config = {
stopOnSpecFailure: queryString.getParam("failFast"),
stopSpecOnExpectationFailure: queryString.getParam("oneFailurePerSpec"),
stopOnSpecFailure: queryString.getParam("stopOnSpecFailure"),
stopSpecOnExpectationFailure: queryString.getParam("stopSpecOnExpectationFailure"),
hideDisabled: queryString.getParam("hideDisabled")
};

View File

@@ -49,8 +49,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
var filterSpecs = !!queryString.getParam("spec");
var config = {
stopOnSpecFailure: queryString.getParam("failFast"),
stopSpecOnExpectationFailure: queryString.getParam("oneFailurePerSpec"),
stopOnSpecFailure: queryString.getParam("stopOnSpecFailure"),
stopSpecOnExpectationFailure: queryString.getParam("stopSpecOnExpectationFailure"),
hideDisabled: queryString.getParam("hideDisabled")
};

View File

@@ -571,7 +571,7 @@ jasmineRequire.HtmlReporter = function(j$) {
var failFastCheckbox = optionsMenuDom.querySelector('#jasmine-fail-fast');
failFastCheckbox.checked = config.stopOnSpecFailure;
failFastCheckbox.onclick = function() {
navigateWithNewParam('failFast', !config.stopOnSpecFailure);
navigateWithNewParam('stopOnSpecFailure', !config.stopOnSpecFailure);
};
var throwCheckbox = optionsMenuDom.querySelector(
@@ -580,7 +580,7 @@ jasmineRequire.HtmlReporter = function(j$) {
throwCheckbox.checked = config.stopSpecOnExpectationFailure;
throwCheckbox.onclick = function() {
navigateWithNewParam(
'oneFailurePerSpec',
'stopSpecOnExpectationFailure',
!config.stopSpecOnExpectationFailure
);
};

View File

@@ -1036,15 +1036,6 @@ getJasmineRequireObj().Env = function(j$) {
* @default null
*/
seed: null,
/**
* Whether to stop execution of the suite after the first spec failure
* @name Configuration#failFast
* @since 3.3.0
* @type Boolean
* @default false
* @deprecated Use the `stopOnSpecFailure` config property instead.
*/
failFast: false,
/**
* Whether to stop execution of the suite after the first spec failure
* @name Configuration#stopOnSpecFailure
@@ -1063,15 +1054,6 @@ getJasmineRequireObj().Env = function(j$) {
* @default false
*/
failSpecWithNoExpectations: false,
/**
* Whether to cause specs to only have one expectation failure.
* @name Configuration#oneFailurePerSpec
* @since 3.3.0
* @type Boolean
* @default false
* @deprecated Use the `stopSpecOnExpectationFailure` config property instead.
*/
oneFailurePerSpec: false,
/**
* Whether to cause specs to only have one expectation failure.
* @name Configuration#stopSpecOnExpectationFailure
@@ -1180,7 +1162,9 @@ getJasmineRequireObj().Env = function(j$) {
var booleanProps = [
'random',
'failSpecWithNoExpectations',
'hideDisabled'
'hideDisabled',
'stopOnSpecFailure',
'stopSpecOnExpectationFailure'
];
booleanProps.forEach(function(prop) {
@@ -1189,70 +1173,6 @@ 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(
'stopOnSpecFailure and failFast are aliases for ' +
"each other. Don't set failFast if you also set stopOnSpecFailure."
);
}
}
config.failFast = configuration.failFast;
config.stopOnSpecFailure = configuration.failFast;
} else if (typeof configuration.stopOnSpecFailure !== 'undefined') {
config.failFast = configuration.stopOnSpecFailure;
config.stopOnSpecFailure = configuration.stopOnSpecFailure;
}
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 !==
configuration.oneFailurePerSpec
) {
throw new Error(
'stopSpecOnExpectationFailure and oneFailurePerSpec are aliases for ' +
"each other. Don't set oneFailurePerSpec if you also set stopSpecOnExpectationFailure."
);
}
}
config.oneFailurePerSpec = configuration.oneFailurePerSpec;
config.stopSpecOnExpectationFailure = configuration.oneFailurePerSpec;
} else if (
typeof configuration.stopSpecOnExpectationFailure !== 'undefined'
) {
config.oneFailurePerSpec = configuration.stopSpecOnExpectationFailure;
config.stopSpecOnExpectationFailure =
configuration.stopSpecOnExpectationFailure;
}
if (configuration.specFilter) {
config.specFilter = configuration.specFilter;
}
@@ -1969,7 +1889,7 @@ getJasmineRequireObj().Env = function(j$) {
expectationFactory: expectationFactory,
asyncExpectationFactory: suiteAsyncExpectationFactory,
expectationResultFactory: expectationResultFactory,
throwOnExpectationFailure: config.oneFailurePerSpec
throwOnExpectationFailure: config.stopSpecOnExpectationFailure
});
return suite;
@@ -2080,7 +2000,7 @@ getJasmineRequireObj().Env = function(j$) {
fn: fn,
timeout: timeout || 0
},
throwOnExpectationFailure: config.oneFailurePerSpec,
throwOnExpectationFailure: config.stopSpecOnExpectationFailure,
timer: new j$.Timer()
});
return spec;
@@ -2274,7 +2194,7 @@ getJasmineRequireObj().Env = function(j$) {
error: error && error.message ? error : null
});
if (config.oneFailurePerSpec) {
if (config.stopSpecOnExpectationFailure) {
throw new Error(message);
}
};

View File

@@ -116,9 +116,7 @@ describe('Env', function() {
var initialConfig = {
random: true,
seed: '123',
failFast: true,
failSpecWithNoExpectations: true,
oneFailurePerSpec: true,
stopSpecOnExpectationFailure: true,
stopOnSpecFailure: true,
hideDisabled: true
@@ -128,9 +126,7 @@ describe('Env', function() {
env.configure({
random: undefined,
seed: undefined,
failFast: undefined,
failSpecWithNoExpectations: undefined,
oneFailurePerSpec: undefined,
stopSpecOnExpectationFailure: undefined,
stopOnSpecFailure: undefined,
hideDisabled: undefined
@@ -141,89 +137,6 @@ 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({
failFast: true,
stopOnSpecFailure: true
})
);
env.configure({ stopOnSpecFailure: false });
expect(env.configuration()).toEqual(
jasmine.objectContaining({
failFast: false,
stopOnSpecFailure: false
})
);
});
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(
'stopOnSpecFailure and failFast are aliases for each ' +
"other. Don't set failFast if you also set stopOnSpecFailure."
);
});
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({
oneFailurePerSpec: true,
stopSpecOnExpectationFailure: true
})
);
env.configure({ stopSpecOnExpectationFailure: false });
expect(env.configuration()).toEqual(
jasmine.objectContaining({
oneFailurePerSpec: false,
stopSpecOnExpectationFailure: false
})
);
});
it('rejects a single call that sets stopSpecOnExpectationFailure and oneFailurePerSpec to different values', function() {
spyOn(env, 'deprecated');
expect(function() {
env.configure({
oneFailurePerSpec: true,
stopSpecOnExpectationFailure: false
});
}).toThrowError(
'stopSpecOnExpectationFailure and oneFailurePerSpec are ' +
"aliases for each other. Don't set oneFailurePerSpec if you also set " +
'stopSpecOnExpectationFailure.'
);
});
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({});

View File

@@ -886,7 +886,7 @@ describe('spec running', function() {
});
});
function behavesLikeStopOnSpecFailureIsOn(configureFn) {
describe('when stopOnSpecFailure is on', function() {
it('does not run further specs when one fails', function(done) {
var actions = [],
config;
@@ -905,25 +905,12 @@ describe('spec running', function() {
});
env.configure({ random: false });
configureFn(env);
env.configure({ stopOnSpecFailure: true });
env.execute(null, function() {
expect(actions).toEqual(['fails']);
done();
});
});
}
describe('when failFast is on', function() {
behavesLikeStopOnSpecFailureIsOn(function(env) {
spyOn(env, 'deprecated');
env.configure({ failFast: true });
});
});
describe('when stopOnSpecFailure is on', function() {
behavesLikeStopOnSpecFailureIsOn(function(env) {
env.configure({ stopOnSpecFailure: true });
});
});
});

View File

@@ -818,7 +818,10 @@ describe('HtmlReporter', function() {
var stopOnFailureUI = container.querySelector('.jasmine-fail-fast');
stopOnFailureUI.click();
expect(navigationHandler).toHaveBeenCalledWith('failFast', true);
expect(navigationHandler).toHaveBeenCalledWith(
'stopOnSpecFailure',
true
);
});
it('should navigate and turn the setting off', function() {
@@ -847,7 +850,10 @@ describe('HtmlReporter', function() {
var stopOnFailureUI = container.querySelector('.jasmine-fail-fast');
stopOnFailureUI.click();
expect(navigationHandler).toHaveBeenCalledWith('failFast', false);
expect(navigationHandler).toHaveBeenCalledWith(
'stopOnSpecFailure',
false
);
});
});
@@ -924,7 +930,10 @@ describe('HtmlReporter', function() {
var throwingExpectationsUI = container.querySelector('.jasmine-throw');
throwingExpectationsUI.click();
expect(navigateHandler).toHaveBeenCalledWith('oneFailurePerSpec', true);
expect(navigateHandler).toHaveBeenCalledWith(
'stopSpecOnExpectationFailure',
true
);
});
it('should navigate and change the setting to off', function() {
@@ -954,7 +963,7 @@ describe('HtmlReporter', function() {
throwingExpectationsUI.click();
expect(navigateHandler).toHaveBeenCalledWith(
'oneFailurePerSpec',
'stopSpecOnExpectationFailure',
false
);
});

View File

@@ -59,15 +59,6 @@ getJasmineRequireObj().Env = function(j$) {
* @default null
*/
seed: null,
/**
* Whether to stop execution of the suite after the first spec failure
* @name Configuration#failFast
* @since 3.3.0
* @type Boolean
* @default false
* @deprecated Use the `stopOnSpecFailure` config property instead.
*/
failFast: false,
/**
* Whether to stop execution of the suite after the first spec failure
* @name Configuration#stopOnSpecFailure
@@ -86,15 +77,6 @@ getJasmineRequireObj().Env = function(j$) {
* @default false
*/
failSpecWithNoExpectations: false,
/**
* Whether to cause specs to only have one expectation failure.
* @name Configuration#oneFailurePerSpec
* @since 3.3.0
* @type Boolean
* @default false
* @deprecated Use the `stopSpecOnExpectationFailure` config property instead.
*/
oneFailurePerSpec: false,
/**
* Whether to cause specs to only have one expectation failure.
* @name Configuration#stopSpecOnExpectationFailure
@@ -203,7 +185,9 @@ getJasmineRequireObj().Env = function(j$) {
var booleanProps = [
'random',
'failSpecWithNoExpectations',
'hideDisabled'
'hideDisabled',
'stopOnSpecFailure',
'stopSpecOnExpectationFailure'
];
booleanProps.forEach(function(prop) {
@@ -212,70 +196,6 @@ 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(
'stopOnSpecFailure and failFast are aliases for ' +
"each other. Don't set failFast if you also set stopOnSpecFailure."
);
}
}
config.failFast = configuration.failFast;
config.stopOnSpecFailure = configuration.failFast;
} else if (typeof configuration.stopOnSpecFailure !== 'undefined') {
config.failFast = configuration.stopOnSpecFailure;
config.stopOnSpecFailure = configuration.stopOnSpecFailure;
}
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 !==
configuration.oneFailurePerSpec
) {
throw new Error(
'stopSpecOnExpectationFailure and oneFailurePerSpec are aliases for ' +
"each other. Don't set oneFailurePerSpec if you also set stopSpecOnExpectationFailure."
);
}
}
config.oneFailurePerSpec = configuration.oneFailurePerSpec;
config.stopSpecOnExpectationFailure = configuration.oneFailurePerSpec;
} else if (
typeof configuration.stopSpecOnExpectationFailure !== 'undefined'
) {
config.oneFailurePerSpec = configuration.stopSpecOnExpectationFailure;
config.stopSpecOnExpectationFailure =
configuration.stopSpecOnExpectationFailure;
}
if (configuration.specFilter) {
config.specFilter = configuration.specFilter;
}
@@ -992,7 +912,7 @@ getJasmineRequireObj().Env = function(j$) {
expectationFactory: expectationFactory,
asyncExpectationFactory: suiteAsyncExpectationFactory,
expectationResultFactory: expectationResultFactory,
throwOnExpectationFailure: config.oneFailurePerSpec
throwOnExpectationFailure: config.stopSpecOnExpectationFailure
});
return suite;
@@ -1103,7 +1023,7 @@ getJasmineRequireObj().Env = function(j$) {
fn: fn,
timeout: timeout || 0
},
throwOnExpectationFailure: config.oneFailurePerSpec,
throwOnExpectationFailure: config.stopSpecOnExpectationFailure,
timer: new j$.Timer()
});
return spec;
@@ -1297,7 +1217,7 @@ getJasmineRequireObj().Env = function(j$) {
error: error && error.message ? error : null
});
if (config.oneFailurePerSpec) {
if (config.stopSpecOnExpectationFailure) {
throw new Error(message);
}
};

View File

@@ -540,7 +540,7 @@ jasmineRequire.HtmlReporter = function(j$) {
var failFastCheckbox = optionsMenuDom.querySelector('#jasmine-fail-fast');
failFastCheckbox.checked = config.stopOnSpecFailure;
failFastCheckbox.onclick = function() {
navigateWithNewParam('failFast', !config.stopOnSpecFailure);
navigateWithNewParam('stopOnSpecFailure', !config.stopOnSpecFailure);
};
var throwCheckbox = optionsMenuDom.querySelector(
@@ -549,7 +549,7 @@ jasmineRequire.HtmlReporter = function(j$) {
throwCheckbox.checked = config.stopSpecOnExpectationFailure;
throwCheckbox.onclick = function() {
navigateWithNewParam(
'oneFailurePerSpec',
'stopSpecOnExpectationFailure',
!config.stopSpecOnExpectationFailure
);
};