title: Ensuring Express App is running before each Mocha Test
body: <p>I am working on developing a REST API using ExpressJS, NodeJS, Mongoose and Mocha.</p>
  
  <p>The thing is that I have an app.coffee file, thats responsible for setting up ExpressJS and connecting to Mongoose. The way I have set this up is that Mongoose is connected first and if that gets through, then, the ExpressJS App is started.</p>
  
  <p>The issue is that when setting up Mocha, I need to make sure that ExpressJS App existing in app.coffee is completely started successfully including all asynchronous code before any testcase is executed.</p>
  
  <p>For that, I have created a test_helper.coffee and placed the following code in it, but, the testcases start their execution even if the code in app.coffee hasn't completed its execution completely which actually makes sense:</p>
  
  <pre><code>before (done) -&gt;
    require(__dirname + '/../src/app')
    done()
  </code></pre>
  
  <p>In a nutshell, I want to make sure that the ExpressJS app has fully completed its setup before any testcase is executed.</p>
  
  <p>How I can do that?</p>