MCPcopy
hub / github.com/vitest-dev/vitest / makeAroundHookTimeoutError

Function makeAroundHookTimeoutError

packages/runner/src/run.ts:248–261  ·  view source on GitHub ↗
(
  hookName: string,
  phase: 'setup' | 'teardown',
  timeout: number,
  stackTraceError?: Error,
)

Source from the content-addressed store, hash-verified

246}
247
248function 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
263async function callAroundHooks<THook extends Function>(
264 runInner: () => Promise<void>,

Callers 1

createTimeoutPromiseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected