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

Function aroundAll

packages/runner/src/hooks.ts:323–349  ·  view source on GitHub ↗
(
  this: unknown,
  fn: AroundAllListener<ExtraContext>,
  timeout?: number,
)

Source from the content-addressed store, hash-verified

321 * ```
322 */
323export function aroundAll<ExtraContext = object>(
324 this: unknown,
325 fn: AroundAllListener<ExtraContext>,
326 timeout?: number,
327): void {
328 assertTypes(fn, '"aroundAll" callback', ['function'])
329 const stackTraceError = new Error('STACK_TRACE_ERROR')
330 const resolvedTimeout = timeout ?? getDefaultHookTimeout()
331 const context = getChainableContext(this)
332
333 return getCurrentSuite().on(
334 'aroundAll',
335 Object.assign(
336 withSuiteFixtures(
337 'aroundAll',
338 fn,
339 context,
340 stackTraceError,
341 1,
342 ) as RegisteredAroundAllListener,
343 {
344 [AROUND_TIMEOUT_KEY]: resolvedTimeout,
345 [AROUND_STACK_TRACE_KEY]: stackTraceError,
346 },
347 ),
348 )
349}
350
351/**
352 * Registers a callback function that wraps around each test within the current suite.

Callers

nothing calls this directly

Calls 6

assertTypesFunction · 0.90
getChainableContextFunction · 0.90
getCurrentSuiteFunction · 0.90
getDefaultHookTimeoutFunction · 0.85
withSuiteFixturesFunction · 0.85
onMethod · 0.45

Tested by

no test coverage detected