修复不应该jest console导致的ci失败

This commit is contained in:
YHH
2025-07-28 17:20:28 +08:00
parent abec2b3648
commit dd8f3714ed
2 changed files with 12 additions and 0 deletions

View File

@@ -507,6 +507,8 @@ describe('Scene - 场景管理系统测试', () => {
});
test('系统处理过程中的异常应该被正确处理', () => {
const consoleSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
class ErrorSystem extends EntitySystem {
constructor() {
super(Matcher.empty().all(PositionComponent));
@@ -527,6 +529,8 @@ describe('Scene - 场景管理系统测试', () => {
expect(() => {
scene.update();
}).not.toThrow();
consoleSpy.mockRestore();
});
test('空场景的更新应该安全', () => {