Consistently identify clenaup fns by a type tag, not position

This was already done for everything except spec cleanup fns, since the
various skip policies need to know the difference between afterEach and
afterAll.
This commit is contained in:
Steve Gravrock
2021-10-11 17:58:40 -07:00
parent 25c3f06839
commit 41f5c53959
13 changed files with 182 additions and 184 deletions

View File

@@ -505,27 +505,28 @@ describe('TreeProcessor', function() {
expect(queueableFns).toEqual([
{ fn: jasmine.any(Function) },
{ type: 'beforeAll', fn: 'beforeAll1', timeout: 1 },
{ type: 'beforeAll', fn: 'beforeAll2', timeout: 2 },
{ fn: 'beforeAll1', timeout: 1 },
{ fn: 'beforeAll2', timeout: 2 },
{ fn: jasmine.any(Function) }
]);
});
it('runs afterAlls for a node with children', function() {
var leaf = new Leaf(),
node = new Node({
children: [leaf],
afterAllFns: [{ fn: 'afterAll1' }, { fn: 'afterAll2' }]
}),
root = new Node({ children: [node] }),
queueRunner = jasmine.createSpy('queueRunner'),
processor = new jasmineUnderTest.TreeProcessor({
afterAllFns = [{ fn: 'afterAll1' }, { fn: 'afterAll2' }];
(node = new Node({
children: [leaf],
afterAllFns
})),
(root = new Node({ children: [node] })),
(queueRunner = jasmine.createSpy('queueRunner')),
(processor = new jasmineUnderTest.TreeProcessor({
tree: root,
runnableIds: [node.id],
queueRunnerFactory: queueRunner
}),
treeComplete = jasmine.createSpy('treeComplete'),
nodeDone = jasmine.createSpy('nodeDone');
})),
(treeComplete = jasmine.createSpy('treeComplete')),
(nodeDone = jasmine.createSpy('nodeDone'));
processor.execute(treeComplete);
var queueableFns = queueRunner.calls.mostRecent().args[0].queueableFns;
@@ -536,8 +537,8 @@ describe('TreeProcessor', function() {
expect(queueableFns).toEqual([
{ fn: jasmine.any(Function) },
{ fn: jasmine.any(Function) },
{ type: 'afterAll', fn: 'afterAll1' },
{ type: 'afterAll', fn: 'afterAll2' }
afterAllFns[0],
afterAllFns[1]
]);
});