Merge branch '3.99' into 4.0
This commit is contained in:
@@ -27,8 +27,8 @@
|
|||||||
var filterSpecs = !!queryString.getParam("spec");
|
var filterSpecs = !!queryString.getParam("spec");
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
failFast: queryString.getParam("failFast"),
|
stopOnSpecFailure: queryString.getParam("failFast"),
|
||||||
oneFailurePerSpec: queryString.getParam("oneFailurePerSpec"),
|
stopSpecOnExpectationFailure: queryString.getParam("oneFailurePerSpec"),
|
||||||
hideDisabled: queryString.getParam("hideDisabled")
|
hideDisabled: queryString.getParam("hideDisabled")
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -49,8 +49,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||||||
var filterSpecs = !!queryString.getParam("spec");
|
var filterSpecs = !!queryString.getParam("spec");
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
failFast: queryString.getParam("failFast"),
|
stopOnSpecFailure: queryString.getParam("failFast"),
|
||||||
oneFailurePerSpec: queryString.getParam("oneFailurePerSpec"),
|
stopSpecOnExpectationFailure: queryString.getParam("oneFailurePerSpec"),
|
||||||
hideDisabled: queryString.getParam("hideDisabled")
|
hideDisabled: queryString.getParam("hideDisabled")
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -569,17 +569,20 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
var failFastCheckbox = optionsMenuDom.querySelector('#jasmine-fail-fast');
|
var failFastCheckbox = optionsMenuDom.querySelector('#jasmine-fail-fast');
|
||||||
failFastCheckbox.checked = config.failFast;
|
failFastCheckbox.checked = config.stopOnSpecFailure;
|
||||||
failFastCheckbox.onclick = function() {
|
failFastCheckbox.onclick = function() {
|
||||||
navigateWithNewParam('failFast', !config.failFast);
|
navigateWithNewParam('failFast', !config.stopOnSpecFailure);
|
||||||
};
|
};
|
||||||
|
|
||||||
var throwCheckbox = optionsMenuDom.querySelector(
|
var throwCheckbox = optionsMenuDom.querySelector(
|
||||||
'#jasmine-throw-failures'
|
'#jasmine-throw-failures'
|
||||||
);
|
);
|
||||||
throwCheckbox.checked = config.oneFailurePerSpec;
|
throwCheckbox.checked = config.stopSpecOnExpectationFailure;
|
||||||
throwCheckbox.onclick = function() {
|
throwCheckbox.onclick = function() {
|
||||||
navigateWithNewParam('oneFailurePerSpec', !config.oneFailurePerSpec);
|
navigateWithNewParam(
|
||||||
|
'oneFailurePerSpec',
|
||||||
|
!config.stopSpecOnExpectationFailure
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
var randomCheckbox = optionsMenuDom.querySelector(
|
var randomCheckbox = optionsMenuDom.querySelector(
|
||||||
|
|||||||
@@ -1042,8 +1042,17 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
* @since 3.3.0
|
* @since 3.3.0
|
||||||
* @type Boolean
|
* @type Boolean
|
||||||
* @default false
|
* @default false
|
||||||
|
* @deprecated Use the `stopOnSpecFailure` config property instead.
|
||||||
*/
|
*/
|
||||||
failFast: false,
|
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
|
* Whether to fail the spec if it ran no expectations. By default
|
||||||
* a spec that ran no expectations is reported as passed. Setting this
|
* a spec that ran no expectations is reported as passed. Setting this
|
||||||
@@ -1060,8 +1069,17 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
* @since 3.3.0
|
* @since 3.3.0
|
||||||
* @type Boolean
|
* @type Boolean
|
||||||
* @default false
|
* @default false
|
||||||
|
* @deprecated Use the `stopSpecOnExpectationFailure` config property instead.
|
||||||
*/
|
*/
|
||||||
oneFailurePerSpec: false,
|
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
|
* A function that takes a spec and returns true if it should be executed
|
||||||
* or false if it should be skipped.
|
* or false if it should be skipped.
|
||||||
@@ -1161,9 +1179,7 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
this.configure = function(configuration) {
|
this.configure = function(configuration) {
|
||||||
var booleanProps = [
|
var booleanProps = [
|
||||||
'random',
|
'random',
|
||||||
'failFast',
|
|
||||||
'failSpecWithNoExpectations',
|
'failSpecWithNoExpectations',
|
||||||
'oneFailurePerSpec',
|
|
||||||
'hideDisabled'
|
'hideDisabled'
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -1173,6 +1189,70 @@ 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) {
|
if (configuration.specFilter) {
|
||||||
config.specFilter = configuration.specFilter;
|
config.specFilter = configuration.specFilter;
|
||||||
}
|
}
|
||||||
@@ -1484,9 +1564,9 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
var queueRunnerFactory = function(options, args) {
|
var queueRunnerFactory = function(options, args) {
|
||||||
var failFast = false;
|
var failFast = false;
|
||||||
if (options.isLeaf) {
|
if (options.isLeaf) {
|
||||||
failFast = config.oneFailurePerSpec;
|
failFast = config.stopSpecOnExpectationFailure;
|
||||||
} else if (!options.isReporter) {
|
} else if (!options.isReporter) {
|
||||||
failFast = config.failFast;
|
failFast = config.stopOnSpecFailure;
|
||||||
}
|
}
|
||||||
options.clearStack = options.clearStack || clearStack;
|
options.clearStack = options.clearStack || clearStack;
|
||||||
options.timeout = {
|
options.timeout = {
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ describe('Env', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('can configure specs to throw errors on expectation failures', function() {
|
it('can configure specs to throw errors on expectation failures', function() {
|
||||||
env.configure({ oneFailurePerSpec: true });
|
env.configure({ stopSpecOnExpectationFailure: true });
|
||||||
|
|
||||||
spyOn(jasmineUnderTest, 'Spec').and.callThrough();
|
spyOn(jasmineUnderTest, 'Spec').and.callThrough();
|
||||||
env.it('foo', function() {});
|
env.it('foo', function() {});
|
||||||
@@ -100,7 +100,7 @@ describe('Env', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('can configure suites to throw errors on expectation failures', function() {
|
it('can configure suites to throw errors on expectation failures', function() {
|
||||||
env.configure({ oneFailurePerSpec: true });
|
env.configure({ stopSpecOnExpectationFailure: true });
|
||||||
|
|
||||||
spyOn(jasmineUnderTest, 'Suite');
|
spyOn(jasmineUnderTest, 'Suite');
|
||||||
env.describe('foo', function() {});
|
env.describe('foo', function() {});
|
||||||
@@ -112,12 +112,15 @@ describe('Env', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('ignores configuration properties that are present but undefined', function() {
|
it('ignores configuration properties that are present but undefined', function() {
|
||||||
|
spyOn(env, 'deprecated');
|
||||||
var initialConfig = {
|
var initialConfig = {
|
||||||
random: true,
|
random: true,
|
||||||
seed: '123',
|
seed: '123',
|
||||||
failFast: true,
|
failFast: true,
|
||||||
failSpecWithNoExpectations: true,
|
failSpecWithNoExpectations: true,
|
||||||
oneFailurePerSpec: true,
|
oneFailurePerSpec: true,
|
||||||
|
stopSpecOnExpectationFailure: true,
|
||||||
|
stopOnSpecFailure: true,
|
||||||
hideDisabled: true
|
hideDisabled: true
|
||||||
};
|
};
|
||||||
env.configure(initialConfig);
|
env.configure(initialConfig);
|
||||||
@@ -128,6 +131,8 @@ describe('Env', function() {
|
|||||||
failFast: undefined,
|
failFast: undefined,
|
||||||
failSpecWithNoExpectations: undefined,
|
failSpecWithNoExpectations: undefined,
|
||||||
oneFailurePerSpec: undefined,
|
oneFailurePerSpec: undefined,
|
||||||
|
stopSpecOnExpectationFailure: undefined,
|
||||||
|
stopOnSpecFailure: undefined,
|
||||||
hideDisabled: undefined
|
hideDisabled: undefined
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -136,6 +141,89 @@ 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() {
|
describe('promise library', function() {
|
||||||
it('can be configured without a custom library', function() {
|
it('can be configured without a custom library', function() {
|
||||||
env.configure({});
|
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) {
|
it('skips to cleanup functions after an error', function(done) {
|
||||||
var actions = [];
|
var actions = [];
|
||||||
|
|
||||||
@@ -821,7 +821,7 @@ describe('spec running', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
env.configure({ oneFailurePerSpec: true });
|
env.configure({ stopSpecOnExpectationFailure: true });
|
||||||
|
|
||||||
env.execute(null, function() {
|
env.execute(null, function() {
|
||||||
expect(actions).toEqual([
|
expect(actions).toEqual([
|
||||||
@@ -852,7 +852,7 @@ describe('spec running', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
env.configure({ oneFailurePerSpec: true });
|
env.configure({ stopSpecOnExpectationFailure: true });
|
||||||
|
|
||||||
env.execute(null, function() {
|
env.execute(null, function() {
|
||||||
expect(actions).toEqual(['beforeEach', 'afterEach']);
|
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() {
|
env.execute(null, function() {
|
||||||
expect(actions).toEqual(['beforeEach', 'afterEach']);
|
expect(actions).toEqual(['beforeEach', 'afterEach']);
|
||||||
@@ -886,9 +886,10 @@ describe('spec running', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('when stopOnSpecFailure is on', function() {
|
function behavesLikeStopOnSpecFailureIsOn(configureFn) {
|
||||||
it('does not run further specs when one fails', function(done) {
|
it('does not run further specs when one fails', function(done) {
|
||||||
var actions = [];
|
var actions = [],
|
||||||
|
config;
|
||||||
|
|
||||||
env.describe('wrapper', function() {
|
env.describe('wrapper', function() {
|
||||||
env.it('fails', function() {
|
env.it('fails', function() {
|
||||||
@@ -903,12 +904,26 @@ describe('spec running', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
env.configure({ random: false, failFast: true });
|
env.configure({ random: false });
|
||||||
|
configureFn(env);
|
||||||
|
|
||||||
env.execute(null, function() {
|
env.execute(null, function() {
|
||||||
expect(actions).toEqual(['fails']);
|
expect(actions).toEqual(['fails']);
|
||||||
done();
|
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 });
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -785,7 +785,7 @@ describe('HtmlReporter', function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
env.configure({ failFast: true });
|
env.configure({ stopOnSpecFailure: true });
|
||||||
|
|
||||||
reporter.initialize();
|
reporter.initialize();
|
||||||
reporter.jasmineDone({});
|
reporter.jasmineDone({});
|
||||||
@@ -839,7 +839,7 @@ describe('HtmlReporter', function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
env.configure({ failFast: true });
|
env.configure({ stopOnSpecFailure: true });
|
||||||
|
|
||||||
reporter.initialize();
|
reporter.initialize();
|
||||||
reporter.jasmineDone({});
|
reporter.jasmineDone({});
|
||||||
@@ -891,7 +891,7 @@ describe('HtmlReporter', function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
env.configure({ oneFailurePerSpec: true });
|
env.configure({ stopSpecOnExpectationFailure: true });
|
||||||
|
|
||||||
reporter.initialize();
|
reporter.initialize();
|
||||||
reporter.jasmineDone({});
|
reporter.jasmineDone({});
|
||||||
@@ -945,7 +945,7 @@ describe('HtmlReporter', function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
env.configure({ oneFailurePerSpec: true });
|
env.configure({ stopSpecOnExpectationFailure: true });
|
||||||
|
|
||||||
reporter.initialize();
|
reporter.initialize();
|
||||||
reporter.jasmineDone({});
|
reporter.jasmineDone({});
|
||||||
|
|||||||
@@ -65,8 +65,17 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
* @since 3.3.0
|
* @since 3.3.0
|
||||||
* @type Boolean
|
* @type Boolean
|
||||||
* @default false
|
* @default false
|
||||||
|
* @deprecated Use the `stopOnSpecFailure` config property instead.
|
||||||
*/
|
*/
|
||||||
failFast: false,
|
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
|
* Whether to fail the spec if it ran no expectations. By default
|
||||||
* a spec that ran no expectations is reported as passed. Setting this
|
* a spec that ran no expectations is reported as passed. Setting this
|
||||||
@@ -83,8 +92,17 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
* @since 3.3.0
|
* @since 3.3.0
|
||||||
* @type Boolean
|
* @type Boolean
|
||||||
* @default false
|
* @default false
|
||||||
|
* @deprecated Use the `stopSpecOnExpectationFailure` config property instead.
|
||||||
*/
|
*/
|
||||||
oneFailurePerSpec: false,
|
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
|
* A function that takes a spec and returns true if it should be executed
|
||||||
* or false if it should be skipped.
|
* or false if it should be skipped.
|
||||||
@@ -184,9 +202,7 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
this.configure = function(configuration) {
|
this.configure = function(configuration) {
|
||||||
var booleanProps = [
|
var booleanProps = [
|
||||||
'random',
|
'random',
|
||||||
'failFast',
|
|
||||||
'failSpecWithNoExpectations',
|
'failSpecWithNoExpectations',
|
||||||
'oneFailurePerSpec',
|
|
||||||
'hideDisabled'
|
'hideDisabled'
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -196,6 +212,70 @@ 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) {
|
if (configuration.specFilter) {
|
||||||
config.specFilter = configuration.specFilter;
|
config.specFilter = configuration.specFilter;
|
||||||
}
|
}
|
||||||
@@ -507,9 +587,9 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
var queueRunnerFactory = function(options, args) {
|
var queueRunnerFactory = function(options, args) {
|
||||||
var failFast = false;
|
var failFast = false;
|
||||||
if (options.isLeaf) {
|
if (options.isLeaf) {
|
||||||
failFast = config.oneFailurePerSpec;
|
failFast = config.stopSpecOnExpectationFailure;
|
||||||
} else if (!options.isReporter) {
|
} else if (!options.isReporter) {
|
||||||
failFast = config.failFast;
|
failFast = config.stopOnSpecFailure;
|
||||||
}
|
}
|
||||||
options.clearStack = options.clearStack || clearStack;
|
options.clearStack = options.clearStack || clearStack;
|
||||||
options.timeout = {
|
options.timeout = {
|
||||||
|
|||||||
@@ -538,17 +538,20 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
var failFastCheckbox = optionsMenuDom.querySelector('#jasmine-fail-fast');
|
var failFastCheckbox = optionsMenuDom.querySelector('#jasmine-fail-fast');
|
||||||
failFastCheckbox.checked = config.failFast;
|
failFastCheckbox.checked = config.stopOnSpecFailure;
|
||||||
failFastCheckbox.onclick = function() {
|
failFastCheckbox.onclick = function() {
|
||||||
navigateWithNewParam('failFast', !config.failFast);
|
navigateWithNewParam('failFast', !config.stopOnSpecFailure);
|
||||||
};
|
};
|
||||||
|
|
||||||
var throwCheckbox = optionsMenuDom.querySelector(
|
var throwCheckbox = optionsMenuDom.querySelector(
|
||||||
'#jasmine-throw-failures'
|
'#jasmine-throw-failures'
|
||||||
);
|
);
|
||||||
throwCheckbox.checked = config.oneFailurePerSpec;
|
throwCheckbox.checked = config.stopSpecOnExpectationFailure;
|
||||||
throwCheckbox.onclick = function() {
|
throwCheckbox.onclick = function() {
|
||||||
navigateWithNewParam('oneFailurePerSpec', !config.oneFailurePerSpec);
|
navigateWithNewParam(
|
||||||
|
'oneFailurePerSpec',
|
||||||
|
!config.stopSpecOnExpectationFailure
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
var randomCheckbox = optionsMenuDom.querySelector(
|
var randomCheckbox = optionsMenuDom.querySelector(
|
||||||
|
|||||||
Reference in New Issue
Block a user