Added a test that verifies skip to cleanup fns after pending()

Because pending() is implemented via the standard exception handling
path, we effectively got this feature for free as a result of the changes
for #1533, particularly 457a2727.

* [#178598493]
* Fixes #1579
This commit is contained in:
Steve Gravrock
2021-10-06 11:05:55 -07:00
parent 1a9d16715d
commit 15710937b8

View File

@@ -904,6 +904,39 @@ describe('spec running', function() {
expect(actions).toEqual(['beforeEach', 'afterEach']);
});
it('skips to cleanup functions after pending() is called', async function() {
const actions = [];
env.describe('Something', function() {
env.beforeEach(function() {
actions.push('outer beforeEach');
pending();
});
env.afterEach(function() {
actions.push('outer afterEach');
});
env.describe('Inner', function() {
env.beforeEach(function() {
actions.push('inner beforeEach');
});
env.afterEach(function() {
actions.push('inner afterEach');
});
env.it('does it', function() {
actions.push('inner it');
});
});
});
await env.execute();
expect(actions).toEqual(['outer beforeEach', 'outer afterEach']);
});
it('runs all reporter callbacks even if one fails', async function() {
const laterReporter = jasmine.createSpyObj('laterReporter', ['specDone']);