Q:

How to get express app variable in a mocha test case?

I need to do some http test on server side. So I'm using mocha and supertest.
But I have a question how to get the app variable that supertest needs?
I'm using mean.io project structure. So there's this gruntfile already in place.
It configs the mocha test like followings:
    mochaTest: {
        options: {
            reporter: 'spec',
            require: 'server.js'
        },
        src: ['test/mocha/**/*.js']
    },

At the end of the server.js file, it exports the express app:
// Start the app by listening on <port>
var port = process.env.PORT || config.port;
app.listen(port);
console.log('Express app started on port ' + port);

// Initializing logger
logger.init(app, passport, mongoose);

// Expose app
exports = module.exports = app;

How can I get the required exported app in a mocha test case?
I don't have a clue.

A:

You can get it simply by call var app = require( 'my/path/to/app.js' );

