diff --git a/packages/core/src/core.ts b/packages/core/src/core.ts index baa028bc..d98e4d7c 100644 --- a/packages/core/src/core.ts +++ b/packages/core/src/core.ts @@ -159,7 +159,14 @@ export function endGroup(): void { */ export async function group(name: string, fn: () => Promise): Promise { startGroup(name) - const result = await fn() - endGroup() + + let result: T + + try { + result = await fn() + } finally { + endGroup() + } + return result }