I read this on the node documentation :
setImmediate(callback, [arg], [...])
To schedule the \"immediate\" execution of callback after I/O
You should check this github issue
The event loop cycle is timers -> I/O -> immediates, rinse and repeat. The documentation is correct but incomplete: it doesn't mention that when you haven't entered the event loop yet (as is the case in your example), then timers come first - but only on the first tick. (In master. To complicate matters, things work slightly less deterministic in v0.10.)