类:MockTimers


¥Class: MockTimers

模拟定时器是软件测试中常用的一种技术,用于模拟和控制定时器(例如 setIntervalsetTimeout)的行为,而无需实际等待指定的时间间隔。

¥Mocking timers is a technique commonly used in software testing to simulate and control the behavior of timers, such as setInterval and setTimeout, without actually waiting for the specified time intervals.

MockTimers 还能够模拟 Date 对象。

¥MockTimers is also able to mock the Date object.

MockTracker 提供顶层 timers 导出,它是 MockTimers 实例。

¥The MockTracker provides a top-level timers export which is a MockTimers instance.