title: Stub out module function
body: <p>Edit: Being a little bit more precise.</p>
  
  <p>I want to test usecases for a Github API wrapper extension, that our team has created. For testing, we don't want to use API wrapper extension directly, so we want to stub out its functions. All calls to the API wrapper should be stubbed out for the tests, not just creating a clone stub.</p>
  
  <p>I have a module "github" in Node.js:</p>
  
  <pre><code>module.exports = function(args, done) {
      ...
  }
  </code></pre>
  
  <p>And I am requiring it like this:</p>
  
  <pre><code>var github = require('../services/github');
  </code></pre>
  
  <p>Now, I would like to stub out <code>github(...)</code> using Sinon.js:</p>
  
  <pre><code>var stub_github = sinon.stub(???, "github", function (args, callback) { 
      console.log("the github(...) call was stubbed out!!");
  });
  </code></pre>
  
  <p>But <code>sinon.stub(...)</code> expects from me to pass an object and a method and does not allow me to stub out a module that is a function.</p>
  
  <p>Any ideas?</p>