I figured out how to do this, and here's my
init.js file:
require('should');
var request = require('supertest');
global.getApp = function(done) {
if (!process.env.UNIT_TEST_HOST) {
process.env.UNIT_TEST_HOST = 'http://127.0.0.1:3005';
}
var app = request(process.env.UNIT_TEST_HOST);
return {
app: app,
baseParams: {
Cookie: 'myCookie=blah'
}
};
};
And then in each unit test, I call getApp(), set my local request var to getApp().app, and use it like I normally would (without having to specify the app in parens when using request).