修复最近项目打开目录测试竞态
Project CI / Repository checks (pull_request) Successful in 1m24s
Project CI / Frontend tests (pull_request) Successful in 3m13s
Project CI / Backend tests (pull_request) Successful in 4m4s
Project CI / Native shell tests (pull_request) Successful in 14m37s

状态文案是在 await invoke 之后才 setStatus 的,而测试的 waitFor 只等到
invoke 被调用——invoke 在点击处理器里是同步发出的,第一次检查就通过并
立即返回,此时状态写入和随后的渲染都还没发生。断言能否看到文案取决于
RTL 内部恰好冲刷了几个微任务,CI 负载高时就翻车。

改用 findByText 显式等待。1543 那条是同一形态的隐患,一并改掉。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-14 12:19:30 +00:00
parent 5f82cc8b72
commit f5dc6050c4
@@ -1515,7 +1515,7 @@ export function registerRecentProjectsTests() {
'open_game_creator_workspace_window',
expect.anything(),
);
expect(screen.getByText('已打开项目目录')).not.toBeNull();
expect(await screen.findByText('已打开项目目录')).not.toBeNull();
expect(window.localStorage.length).toBe(1);
});
@@ -1540,7 +1540,7 @@ export function registerRecentProjectsTests() {
projectPath: '/tmp/typed-game',
});
});
expect(screen.getByText('已打开项目目录')).not.toBeNull();
expect(await screen.findByText('已打开项目目录')).not.toBeNull();
});
it('rejects invalid typed launcher project directories before opening them', () => {