How to run mocha tests and node in a single npm test command ? (CI)
<p>I want to use <a href="https://circleci.com/" rel="nofollow">Circle CI</a> to integrate a git project. </p>

<p>I'm using <code>mocha</code> for my tests . </p>

<h3>What i want to do?</h3>

<p>When running <code>npm test</code> I want:</p>

<ul>
<li>my node server to start</li>
<li>my test file to run</li>
</ul>

<p>How can I run a single <code>npm test</code> command to run both node and my mocha tests which are already wrapped in a single <code>index.js</code> file. </p>

<p>I have tried this in my <code>package.json</code>: </p>

<pre><code>  "scripts": {
    "test": "node server/app.js &amp; mocha server/tests/index.js",
    "start": "node server/app.js",
    "postinstall": "bower install"
   }
</code></pre>

<h3>The problems with the above</h3>

<ul>
<li>My server takes some time to start and the tests fail since they run before the server starts</li>
</ul>

<p>Is there a standard way to run a server and the tests with a single command but I'm missing something?</p>