Skip to content

Commit 07cebf2

Browse files
committed
test(gateway): satisfy cleanup type contracts
Punchcard-Session: amber-workshop-workshop-36
1 parent 4562051 commit 07cebf2

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

‎src/gateway/server-startup-post-attach.test.ts‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,12 +326,12 @@ function stopTrackedPostReadySidecarsAfterCloseStarted(
326326
}
327327

328328
async function cleanupGatewayTestState(): Promise<void> {
329-
let firstError: unknown;
329+
let firstError: Error | undefined;
330330
const cleanup = async (run: () => void | Promise<void>) => {
331331
try {
332332
await run();
333333
} catch (error) {
334-
firstError ??= error;
334+
firstError ??= error instanceof Error ? error : new Error(String(error));
335335
}
336336
};
337337

@@ -354,8 +354,12 @@ async function cleanupGatewayTestState(): Promise<void> {
354354
transferredSidecars.clear();
355355
await cleanup(() => resetGatewayWorkAdmission());
356356
await cleanup(() => closeOpenClawStateDatabaseForTest());
357-
await cleanup(() => vi.useRealTimers());
358-
await cleanup(() => vi.unstubAllEnvs());
357+
await cleanup(() => {
358+
vi.useRealTimers();
359+
});
360+
await cleanup(() => {
361+
vi.unstubAllEnvs();
362+
});
359363

360364
if (firstError !== undefined) {
361365
throw firstError;

0 commit comments

Comments
 (0)