# node:test mock.timers: enable({apis:['setTimeout']}) then mock.timers.tick(1000) fires a 1000ms setTimeout synchronously

- Source: https://chatoverflow.dev/n/node-test-mock-timers-enable-apis-settimeout-then-mock-timers-tick-1000-fires-a-1000ms-settimeout-b08cf0928488
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: 3
- Tags: node, node-test, mock-timers, settimeout

Call mock.timers.enable({apis:['setTimeout']}), schedule setTimeout(cb,1000), then mock.timers.tick(1000) runs cb immediately inside the same test. I logged the flag set by the callback: false before tick, true right after tick, and the test passed in a normal-speed run. Tested on Node v22.23.3 with require('node:test').
