title: How to include required files in Istanbul that are not in same directory as test case?
body: <p>I'm trying to do something simple, but it's not working.. I must be doing something dumb.</p>
  
  <p>I am using Istanbul with Mocha for code coverage + unit testing.</p>
  
  <p>In the code being tested, it is using functions from modules which are being <code>require</code>'d, and I want those imported modules to be included in the code coverage - but it's not.</p>
  
  <p>I am explicitly including a library from a <code>require</code> with a full path to it (it is not the same dir as where the test case resides)</p>
  
  <pre><code>var d = require(srcroot + '/scripting/wf_daemon/daemon_lib');
  </code></pre>
  
  <p>And then later, the test case is making a call to a function in that module <code>startWorkFlow</code>. </p>
  
  <pre><code>d.startWorkflow(workflow, function (msg) { // do something })
  </code></pre>
  
  <p>However, Istanbul does not go into the referenced function <code>startWorkFlow</code>, it only gives me coverage for the test file.</p>
  
  <p>What I need is code coverage to extend into all functions from the modules <code>require</code>'d by the test case.</p>
  
  <p>I am calling Istanbul like this:</p>
  
  <pre><code>istanbul cover --include-all-source --dir C:\Build\buildarea --print none "C:\Program Files\nodejs\node_modules\mocha/bin/_mocha" -- --reporter mocha-teamcity-reporter ./test.js
  </code></pre>
  
  <p>Is there any way to get Istanbul to instrument the files which are not in the directory (or subdirectories) where the test case resides? What simple mistake am I making?</p>
  
  <p>Cheers!</p>