{"record":{"id":"637c23b25bb37162","repo":"vitest-dev/vitest","slug":"the-callbackname-callback-was-not-called-in-t","errorCode":null,"errorMessage":"The `${callbackName}` callback was not called in the `${hookName}` hook. Make sure to call `${callbackName}` to run the ${hookName === 'aroundEach' ? 'test' : 'suite'}.","messagePattern":"The `(.+?)` callback was not called in the `(.+?)` hook\\. Make sure to call `(.+?)` to run the (.+?)\\.","errorType":"exception","errorClass":"AroundHookSetupError","httpStatus":null,"severity":"error","filePath":"packages/vitest/src/runtime/runner/run.ts","lineNumber":386,"sourceCode":"\n      // Start teardown timer after inner hooks complete - only times this hook's teardown code\n      teardownTimeout = createTimeoutPromise(timeout, 'teardown', stackTraceError)\n\n      // Signal that use() is returning (teardown phase starting)\n      resolveUseReturned()\n    }\n\n    setupLimitConcurrencyRelease = await limitMaxConcurrency.acquire()\n\n    // Start setup timeout\n    setupTimeout = createTimeoutPromise(timeout, 'setup', stackTraceError)\n\n    // Run the hook in the background\n    ;(async () => {\n      try {\n        await invokeHook(hook, use)\n        if (!useCalled) {\n          throw new AroundHookSetupError(\n            `The \\`${callbackName}\\` callback was not called in the \\`${hookName}\\` hook. `\n            + `Make sure to call \\`${callbackName}\\` to run the ${hookName === 'aroundEach' ? 'test' : 'suite'}.`,\n          )\n        }\n        resolveHookComplete()\n      }\n      catch (error) {\n        rejectHookComplete(error as Error)\n      }\n      finally {\n        setupLimitConcurrencyRelease?.()\n        teardownLimitConcurrencyRelease?.()\n      }\n    })()\n\n    // Wait for either: use() to be called OR hook to complete (error) OR setup timeout\n    try {\n      await Promise.race([","sourceCodeStart":368,"sourceCodeEnd":404,"githubUrl":"https://github.com/vitest-dev/vitest/blob/1fa9837ec26533512fdcad8baebf249771bd340a/packages/vitest/src/runtime/runner/run.ts#L368-L404","documentation":"AroundHookSetupError thrown when an aroundEach/aroundAll hook function returns/resolves without ever calling the provided runTest/use callback. Because around hooks own the test/suite execution, skipping the callback means the inner tests never run silently. Vitest detects useCalled === false after invokeHook resolves and raises this.","triggerScenarios":"Writing `aroundEach(async (runTest) => { await setup() })` and forgetting `await runTest()`; an early return before runTest; an exception swallowed before runTest is reached.","commonSituations":"Incomplete refactor of a beforeEach into aroundEach; conditional that skips runTest on some path; awaiting a promise that rejects and catching it without calling runTest.","solutions":["Always call `await runTest()` (or `await use(value)` for the use-pattern) exactly once in the hook.","Place runTest in the main flow, not behind a condition that can skip it.","If using the builder fixture pattern, make sure `use(value)` is invoked."],"exampleFix":"// before\naroundEach(async (runTest) => {\n  await db.connect()\n  // forgot runTest()\n})\n\n// after\naroundEach(async (runTest) => {\n  await db.connect()\n  await runTest()\n  await db.disconnect()\n})","handlingStrategy":"validation","validationCode":"function assertAroundCallsRunTest(fnSrc: string) {\n  if (!/runTest\\(|use\\(/.test(fnSrc)) {\n    throw new Error('aroundEach body must call runTest/use')\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  await runWithAroundHook()\n} catch (e) {\n  if (e instanceof AroundHookSetupError) {\n    // add the missing runTest() call\n  } else throw e\n}","preventionTips":["Always type the aroundEach callback so the runTest param is visible.","Use a linter/template that includes `await runTest()` by default.","Review hooks after refactoring beforeEach into aroundEach."],"tags":["hooks","around-hook","lifecycle"],"backgroundTag":null,"analyzedSha":"1fa9837ec26533512fdcad8baebf249771bd340a","analyzedAt":"2026-08-11T16:11:39.638Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}