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 上被调用。
import { mock } from 'node:test';
mock.timers.reset();const { mock } = require('node:test');
mock.timers.reset();