Unit Testing Express app in Jenkins

Ok, I'm searching a couple of hours for a solution to run my Mocha unit tests inside Jenkins, for my Express JS app.

Writing tests is quite easy, but connecting the tests with my app is a bit harder. An example of my current test:

/tests/backend/route.test.js

var should    = require('should'),
    assert    = require('assert'),
    request   = require('supertest'),
    express   = require('express');

describe('Routing', function() {

  var app = 'http://someurl.com';

  describe('Account', function() {
    it('should return error trying to save duplicate username', function(done) {
      var profile = {
        username: 'vgheri',
        password: 'test',
        firstName: 'Valerio',
        lastName: 'Gheri'
      };
    // once we have specified the info we want to send to the server via POST verb,
    // we need to actually perform the action on the resource, in this case we want to 
    // POST on /api/profiles and we want to send some info
    // We do this using the request object, requiring supertest!
    request(app)
    .post('/api/profiles')
    .send(profile)
    // end handles the response
    .end(function(err, res) {
          if (err) {
            throw err;
          }
          // this is should.js syntax, very clear
          res.should.have.status(400);
          done();
        });
    });
});

In above example I connect to a running app (see ```var app = 'http://someurl.com'``). Obviously this is not working inside Jenkins, except if I can tell Jenkins to first run the app and then check for a localhost url. But how to do this?

Now if I take a look at https://www.npmjs.org/package/supertest this should be enough to test my express app:

var request = require('supertest')
  , express = require('express');

var app = express();

But it's not. I receive 404 errors on all urls which I would like to test.

Anyone who knows how to test my app inside Jenkins?