title: How to properly require modules from mocha.opts file
body: <p>I'm using the expect.js library with my mocha unit tests.  Currently, I'm requiring the library on the first line of each file, like this:</p>
  
  <pre><code>var expect = require('expect.js');
  
  describe('something', function () {
      it('should pass', function () {
          expect(true).to.be(true); // works
      });
  });
  </code></pre>
  
  <p><strong>If possible, I'd like to remove the boilerplate require code from the first line of each file</strong>, and have my unit tests magically know about <code>expect</code>.  I thought I might be able to do this using the <a href="http://mochajs.org/#mocha-opts" rel="noreferrer">mocha.opts</a> file:</p>
  
  <pre><code>--require ./node_modules/expect.js/index.js
  </code></pre>
  
  <p>But now I get the following error when running my test:</p>
  
  <blockquote>
    <p>ReferenceError: expect is not defined</p>
  </blockquote>
  
  <p>This seems to make sense - how can it know that the reference to <code>expect</code> in my tests refers to what is exported by the expect.js library?</p>
  
  <p>The expect library is definitely getting loaded, as if I change the path to something non-existent then mocha says:</p>
  
  <blockquote>
    <p>"Error: Cannot find module './does-not-exist.js'"</p>
  </blockquote>
  
  <p>Is there any way to accomplish what I want?  I'm running my tests from a gulp task if perhaps that could help.</p>