( hookName: string, phase: 'setup' | 'teardown', timeout: number, stackTraceError?: Error, )
| 246 | } |
| 247 | |
| 248 | function makeAroundHookTimeoutError( |
| 249 | hookName: string, |
| 250 | phase: 'setup' | 'teardown', |
| 251 | timeout: number, |
| 252 | stackTraceError?: Error, |
| 253 | ) { |
| 254 | const message = `The ${phase} phase of "${hookName}" hook timed out after ${timeout}ms.` |
| 255 | const ErrorClass = phase === 'setup' ? AroundHookSetupError : AroundHookTeardownError |
| 256 | const error = new ErrorClass(message) |
| 257 | if (stackTraceError?.stack) { |
| 258 | error.stack = stackTraceError.stack.replace(stackTraceError.message, error.message) |
| 259 | } |
| 260 | return error |
| 261 | } |
| 262 | |
| 263 | async function callAroundHooks<THook extends Function>( |
| 264 | runInner: () => Promise<void>, |
no outgoing calls
no test coverage detected