Renamed failFast and oneFailurePerSpec config props to stopOnSpecFailure and stopSpecOnExpectationFailure
The new names are more self-explanatory and consistent with jasmine-npm. The old names are deprecated but still work. [#178682783]
This commit is contained in:
@@ -65,8 +65,17 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
* @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
|
||||
* @since 3.9.0
|
||||
* @type Boolean
|
||||
* @default false
|
||||
*/
|
||||
stopOnSpecFailure: false,
|
||||
/**
|
||||
* Whether to fail the spec if it ran no expectations. By default
|
||||
* a spec that ran no expectations is reported as passed. Setting this
|
||||
@@ -83,8 +92,17 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
* @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
|
||||
* @since 3.3.0
|
||||
* @type Boolean
|
||||
* @default false
|
||||
*/
|
||||
stopSpecOnExpectationFailure: false,
|
||||
/**
|
||||
* A function that takes a spec and returns true if it should be executed
|
||||
* or false if it should be skipped.
|
||||
@@ -172,9 +190,7 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
this.configure = function(configuration) {
|
||||
var booleanProps = [
|
||||
'random',
|
||||
'failFast',
|
||||
'failSpecWithNoExpectations',
|
||||
'oneFailurePerSpec',
|
||||
'hideDisabled'
|
||||
];
|
||||
|
||||
@@ -184,6 +200,46 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
}
|
||||
});
|
||||
|
||||
if (typeof configuration.failFast !== 'undefined') {
|
||||
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') {
|
||||
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;
|
||||
}
|
||||
@@ -515,7 +571,7 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
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.configure({ stopOnSpecFailure: !!value });
|
||||
};
|
||||
|
||||
this.stoppingOnSpecFailure = function() {
|
||||
@@ -609,9 +665,9 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
var queueRunnerFactory = function(options, args) {
|
||||
var failFast = false;
|
||||
if (options.isLeaf) {
|
||||
failFast = config.oneFailurePerSpec;
|
||||
failFast = config.stopSpecOnExpectationFailure;
|
||||
} else if (!options.isReporter) {
|
||||
failFast = config.failFast;
|
||||
failFast = config.stopOnSpecFailure;
|
||||
}
|
||||
options.clearStack = options.clearStack || clearStack;
|
||||
options.timeout = {
|
||||
|
||||
@@ -527,17 +527,20 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
);
|
||||
|
||||
var failFastCheckbox = optionsMenuDom.querySelector('#jasmine-fail-fast');
|
||||
failFastCheckbox.checked = config.failFast;
|
||||
failFastCheckbox.checked = config.stopOnSpecFailure;
|
||||
failFastCheckbox.onclick = function() {
|
||||
navigateWithNewParam('failFast', !config.failFast);
|
||||
navigateWithNewParam('failFast', !config.stopOnSpecFailure);
|
||||
};
|
||||
|
||||
var throwCheckbox = optionsMenuDom.querySelector(
|
||||
'#jasmine-throw-failures'
|
||||
);
|
||||
throwCheckbox.checked = config.oneFailurePerSpec;
|
||||
throwCheckbox.checked = config.stopSpecOnExpectationFailure;
|
||||
throwCheckbox.onclick = function() {
|
||||
navigateWithNewParam('oneFailurePerSpec', !config.oneFailurePerSpec);
|
||||
navigateWithNewParam(
|
||||
'oneFailurePerSpec',
|
||||
!config.stopSpecOnExpectationFailure
|
||||
);
|
||||
};
|
||||
|
||||
var randomCheckbox = optionsMenuDom.querySelector(
|
||||
|
||||
Reference in New Issue
Block a user