I understand module.export and require mannner:
Requiring external js file for mocha testing
Although it\'s pretty usable as long a
I usually include a _test object containing references to all my "private" internal variables and functions and expose it on exports. In your case:
./app.js
var INFINITY = 'infinity';
function foo() {
return 'bar';
}
exports._test = {
INFINITY: INFINITY,
foo: foo
}
./test/app-test.js
var app = require('../app.js')
/* ... */
it('should equal bar', function() {
expect(app._test.foo()).to.equal('bar');
});
it('should equal infinity', function() {
expect(app._test.INFINITY).to.equal('infinity');
});