Run afterAll fns after failure even if stopOnSpecFailure is true
[#160905297]
This commit is contained in:
@@ -95,6 +95,23 @@ describe('CompleteOnFirstErrorSkipPolicy', function() {
|
||||
policy.fnErrored(0);
|
||||
expect(policy.skipTo(0)).toEqual(1);
|
||||
});
|
||||
|
||||
it('does not skip afterAll fns, even if before the first cleanup fn index', function() {
|
||||
const fns = [
|
||||
{ fn: () => {} },
|
||||
{
|
||||
fn: () => {},
|
||||
type: 'afterAll'
|
||||
}
|
||||
];
|
||||
const policy = new jasmineUnderTest.CompleteOnFirstErrorSkipPolicy(
|
||||
fns,
|
||||
2
|
||||
);
|
||||
|
||||
policy.fnErrored(0);
|
||||
expect(policy.skipTo(0)).toEqual(1);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1153,6 +1153,41 @@ describe('spec running', function() {
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('runs afterAll functions', async function() {
|
||||
const actions = [];
|
||||
|
||||
env.describe('outer suite', function() {
|
||||
env.describe('inner suite', function() {
|
||||
env.it('fails', function() {
|
||||
actions.push('fails');
|
||||
env.expect(1).toBe(2);
|
||||
});
|
||||
|
||||
env.afterAll(function() {
|
||||
actions.push('inner afterAll');
|
||||
});
|
||||
});
|
||||
|
||||
env.afterAll(function() {
|
||||
actions.push('outer afterAll');
|
||||
});
|
||||
});
|
||||
|
||||
env.afterAll(function() {
|
||||
actions.push('top afterAll');
|
||||
});
|
||||
|
||||
env.configure({ stopOnSpecFailure: true });
|
||||
await env.execute();
|
||||
|
||||
expect(actions).toEqual([
|
||||
'fails',
|
||||
'inner afterAll',
|
||||
'outer afterAll',
|
||||
'top afterAll'
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('run multiple times', function() {
|
||||
|
||||
Reference in New Issue
Block a user