title: How to get environment variable in npm script?
body: <p>I am trying to access an enviroment variable in the npm script itself like so:</p>
  
  <pre><code>"scripts": {
    "test": "istanbul cover node_modules/.bin/_mocha --root ../SERVER/routes -- --recursive"
  },
  </code></pre>
  
  <p>And start this script like so:</p>
  
  <pre><code>SERVER=somewhere npm test
  </code></pre>
  
  <p>How can I get the resolved value of <code>SERVER</code> variable in the npm script in the package.json itself?</p>