title: How to access and test an internal (non-exports) function in a node.js module?
body: <p>I'm trying to figure out on how to test internal (i.e. not exported) functions in nodejs (preferably with mocha or jasmine). And i have no idea!</p>
  
  <p>Let say I have a module like that:</p>
  
  <pre><code>function exported(i) {
     return notExported(i) + 1;
  }
  
  function notExported(i) {
     return i*2;
  }
  
  exports.exported = exported;
  </code></pre>
  
  <p>And the following test (mocha):</p>
  
  <pre><code>var assert = require('assert'),
      test = require('../modules/core/test');
  
  describe('test', function(){
  
    describe('#exported(i)', function(){
      it('should return (i*2)+1 for any given i', function(){
        assert.equal(3, test.exported(1));
        assert.equal(5, test.exported(2));
      });
    });
  });
  </code></pre>
  
  <p>Is there any way to unit test the <code>notExported</code> function without actually exporting it since it's not meant to be exposed?</p>