title: Testing Node.js, mock out and test a module that has been required?
body: <p>I am struggling to write high quality tests around my node modules. The problem is the require module system. I want to be able to check that a certain required module has a method or its state has changed. There seem to be 2 relatively small libraries which can be used here: <a href="https://github.com/felixge/node-gently" rel="noreferrer">node-gently</a> and <a href="https://github.com/mfncooper/mockery" rel="noreferrer">mockery</a>. However, due to their low 'profile' it makes me think that either people don't test this, or there is another way of doing this that I am not aware of. </p>
  
  <p>What is the best way to mock out and test a module that has been required?</p>