Merge branch '3.99' into 4.0
This commit is contained in:
@@ -88,7 +88,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').and.callThrough();
|
||||
env.it('foo', function() {});
|
||||
@@ -100,7 +100,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() {});
|
||||
@@ -112,12 +112,15 @@ describe('Env', function() {
|
||||
});
|
||||
|
||||
it('ignores configuration properties that are present but undefined', function() {
|
||||
spyOn(env, 'deprecated');
|
||||
var initialConfig = {
|
||||
random: true,
|
||||
seed: '123',
|
||||
failFast: true,
|
||||
failSpecWithNoExpectations: true,
|
||||
oneFailurePerSpec: true,
|
||||
stopSpecOnExpectationFailure: true,
|
||||
stopOnSpecFailure: true,
|
||||
hideDisabled: true
|
||||
};
|
||||
env.configure(initialConfig);
|
||||
@@ -128,6 +131,8 @@ describe('Env', function() {
|
||||
failFast: undefined,
|
||||
failSpecWithNoExpectations: undefined,
|
||||
oneFailurePerSpec: undefined,
|
||||
stopSpecOnExpectationFailure: undefined,
|
||||
stopOnSpecFailure: 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() {
|
||||
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']);
|
||||
@@ -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) {
|
||||
var actions = [];
|
||||
var actions = [],
|
||||
config;
|
||||
|
||||
env.describe('wrapper', 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() {
|
||||
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 });
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user