Fix #20: return err, server instead of just server
Apply replacement of the original registry also for custom mocks

I noticed that issue when I was running the tests, with my npm
cache cleaned and no network connection.