MCPcopy
hub / github.com/jestjs/jest / getAllHooksForDescribe

Function getAllHooksForDescribe

packages/jest-circus/src/utils.ts:113–135  ·  view source on GitHub ↗
(
  describe: Circus.DescribeBlock,
)

Source from the content-addressed store, hash-verified

111};
112
113export const getAllHooksForDescribe = (
114 describe: Circus.DescribeBlock,
115): DescribeHooks => {
116 const result: DescribeHooks = {
117 afterAll: [],
118 beforeAll: [],
119 };
120
121 if (hasEnabledTest(describe)) {
122 for (const hook of describe.hooks) {
123 switch (hook.type) {
124 case 'beforeAll':
125 result.beforeAll.push(hook);
126 break;
127 case 'afterAll':
128 result.afterAll.push(hook);
129 break;
130 }
131 }
132 }
133
134 return result;
135};
136
137type TestHooks = {
138 beforeEach: Array<Circus.Hook>;

Callers 1

Calls 1

hasEnabledTestFunction · 0.85

Tested by

no test coverage detected