Mocha test that runs locally won't run on Jenkins (environment issue)
<p>I'm currently trying to implement CI with Jenkins for an emberjs node project that uses mocha for unit testing. I'm running Jenkins on an Amazon EC2 server.</p>

<p>When I run mocha locally (both on my desktop, AND on the ec2 server) I get this:</p>

<pre><code>./node_modules/mocha/bin/mocha 
Initializing server on port 8090


  Unit Test for /test
test API call incoming
key res value is: test!
    ✓ gives a json object with res: test!


  1 passing (35ms)
</code></pre>

<p>However, when I have jenkins set up to run this same command:</p>

<pre><code>01:44:46 + ./node_modules/mocha/bin/mocha
01:44:46 
01:44:46 /var/lib/jenkins/workspace/Rekindle2_Node/server/routes/test/getTest.js:4
01:44:46 const getTest = (req, res) =&gt; {
01:44:46                             ^
01:44:46 SyntaxError: Unexpected token &gt;
etc
</code></pre>

<p>I've double checked, the package.json has everything I need, and I know that I don't have anything globally installed that changes things (as I managed to git clone, npm install, and run mocha from the ec2 instance). All I know is that jenkins sometimes can have issues with consuming environment variables from the server it's running on? Does anyone know what the issue I'm encountering could be? I've tried uninstalling and reinstalling node as well, it could be that Jenkins is looking at an older installation of node while the ec2 is not. Is there any way to tell this? How do I look at the environment variables of a specific build?</p>