timers.reset()
此函数恢复此 MockTimers 实例之前创建的所有模拟的默认行为,并取消这些模拟与 MockTracker 实例的关联。
¥This function restores the default behavior of all mocks that were previously
created by this MockTimers instance and disassociates the mocks
from the MockTracker instance.
注意:每次测试完成后,都会在测试上下文的 MockTracker 上调用此函数。
¥Note: After each test completes, this function is called on
the test context's MockTracker.
import { mock } from 'node:test';
mock.timers.reset();const { mock } = require('node:test');
mock.timers.reset();