Only use setImmediate in test when available.