diff --git a/src/core.ts b/src/core.ts index baa028b..d98e4d7 100644 --- a/src/core.ts +++ b/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 }