( fn: AfterEachListener<ExtraContext>, timeout?: number, )
| 199 | * ``` |
| 200 | */ |
| 201 | export function afterEach<ExtraContext = object>( |
| 202 | fn: AfterEachListener<ExtraContext>, |
| 203 | timeout?: number, |
| 204 | ): void { |
| 205 | assertTypes(fn, '"afterEach" callback', ['function']) |
| 206 | const wrapper: AfterEachListener<ExtraContext> = (context, suite) => { |
| 207 | const fixtureResolver = withFixtures(fn, { suite }) |
| 208 | return fixtureResolver(context) |
| 209 | } |
| 210 | |
| 211 | return getCurrentSuite<ExtraContext>().on( |
| 212 | 'afterEach', |
| 213 | withTimeout( |
| 214 | wrapper, |
| 215 | timeout ?? getDefaultHookTimeout(), |
| 216 | true, |
| 217 | new Error('STACK_TRACE_ERROR'), |
| 218 | abortIfTimeout, |
| 219 | ), |
| 220 | ) |
| 221 | } |
| 222 | |
| 223 | /** |
| 224 | * Registers a callback function to be executed when a test fails within the current suite. |
no test coverage detected