test(ui): retain primary cleanup failures

This commit is contained in:
Yuneng Jiang 2026-09-17 23:27:54 -07:00
parent 99ec682a05
commit 1c08c78ad5
No known key found for this signature in database

View file

@ -46,7 +46,9 @@ export async function runWithCleanup(
try {
if (outcome.status === "failure") throw outcome.error;
} finally {
const cleanupSucceeded = await cleanup().catch(() => false);
const cleanupSucceeded = await Promise.resolve()
.then(cleanup)
.catch(() => false);
if (outcome.status === "success" && !cleanupSucceeded) {
throw new Error("Failed to clean up UI E2E resource");
}