title: Run node server in background and start karma from npm script
body: <p>I'd like to run a node server in background and start karma (on win7). Writing a bash script like the following (and run it with git bash) appears to work, but it reports to a separate window instead of the WebStorm terminal:</p>
  
  <pre><code>#!/bin/bash
  
  node test/server/index.js &amp;
  karma start karma.conf.js
  </code></pre>
  
  <p>package.json</p>
  
  <pre><code>  "scripts": {
      "test": "test.sh"
    },
  </code></pre>
  
  <p>If I try it with git bash and <code>bash test.sh</code> then it reports to the same window.</p>
  
  <p>I tried to do something similar in npm, but it cannot run background processes.</p>
  
  <pre><code>  "scripts": {
      "test": "node test/server/index.js &amp; karma start karma.conf.js"
    },
  </code></pre>
  
  <p>No matter how I try it can run things only in a single process, so it waits for the node server to exit, and thus the karma server never starts.</p>
  
  <p>Any idea how to solve the bash reporting to WebStorm terminal or the npm parallelization?</p>
  
  <p><strong>update:</strong></p>
  
  <p>I think I have found the reason: <a href="https://github.com/npm/npm/issues/8358" rel="nofollow noreferrer">https://github.com/npm/npm/issues/8358</a> This seems to be a Windows related issue. On Linux it would work properly. So it is not possible to fix the npm script. I think instead of bash I'll move the karma server and the node server to a node script and create a child process for the node server to be Windows compatible. I hope that way the karma logs will show up in the WebStorm terminal. </p>