Replaced setTimeout method with custom impl to workaround jsdom issue