title: Unit testing/code coverage when dependency injection isn't possible
body: <p>This problem is best explained with code, so lets say you have a Javascript file called <code>myFancyLibrary.js</code> that looks like this:</p>
  
  <pre><code>var curl = require("node-curl");
  var MyApiRequester = require("./MyApiRequester");
  
  module.exports = {
      wasCalled: false,
      makeRequest: function(){
          this.wasCalled = true;
          var requester = new MyApiRequester( curl );
          requester.send();
      }
  };
  </code></pre>
  
  <p>As you can see, curl is passed as a parameter so <code>MyApiRequester</code>'s unit tests can use a mock/stub and not actually make cURL requests.</p>
  
  <p>My question is how could you unit test <code>makeRequest()</code> without making a curl request?</p>
  
  <p>I realize that you could just create a wrapper for <code>myFancyLibrary.js</code> and pass <code>MyApiRequester</code> in as a parameter, but then the wrapper will just have the same problem.</p>
  
  <p>The highest level module will inevitably be unable to receive dependency injected objects since there is nowhere to receive them from. Is there any way around this?</p>