From 3d4c42901c0e510e59f53df43c5c25233dea5ba7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Fri, 2 Oct 2026 13:06:30 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A4=E8=AF=81=E8=B6=85=E6=97=B6=E7=94=A8?= =?UTF-8?q?=E4=BE=8B=E6=96=AD=E8=A8=80=E7=B2=BE=E7=A1=AE=E5=88=B0=E4=B8=80?= =?UTF-8?q?=E6=9D=A1=E6=8B=92=E7=BB=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - auth.suite:启动超时用例先断言恰好捕获 1 条拒绝,再断言它是含「检查登录状态超时」的 Error - 原来的 some(...) 只看有没有命中,无关 unhandledrejection 会被这段捕获静默吞掉、测不出回归 --- .../tests/appSurface/auth.suite.ts | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/apps/ai-game-creator-shell/tests/appSurface/auth.suite.ts b/apps/ai-game-creator-shell/tests/appSurface/auth.suite.ts index 375b53b2a..24b61408c 100644 --- a/apps/ai-game-creator-shell/tests/appSurface/auth.suite.ts +++ b/apps/ai-game-creator-shell/tests/appSurface/auth.suite.ts @@ -131,16 +131,12 @@ export function registerAuthTests() { return null; }); - await waitFor( - () => - expect( - rejections.reasons.some( - (reason) => - reason instanceof Error && - reason.message.includes('检查登录状态超时'), - ), - ).toBe(true), - { timeout: 20_000 }, + await waitFor(() => expect(rejections.reasons).toHaveLength(1), { + timeout: 20_000, + }); + expect(rejections.reasons[0]).toBeInstanceOf(Error); + expect((rejections.reasons[0] as Error).message).toContain( + '检查登录状态超时', ); // 启动检查失败在改动前就会显示原因 + 重试按钮;上报是叠加的,不是替换。 expect(