title: How to wait for server start complete from an npm script?
body: <p>I'm trying to run a functional test for a node app.</p>
  <p>In my <code>package.json</code> I have the following scripts:</p>
  <pre class="lang-json prettyprint-override"><code>&quot;scripts&quot;: {
    &quot;web-server&quot;: &quot;NODE_ENV=test node app.js &amp;&quot;,
    &quot;test&quot;: &quot;npm run web-server &amp;&amp; mocha ./tests/functional/*.js --exit&quot;,
    &quot;posttest&quot;: &quot;pkill -f node&quot;
  }
  </code></pre>
  <p>But when running it, tests run before the server completes starting.</p>
  <p>How can I wait for the server?</p>