samedi 18 juin 2016

Mocha test that runs locally won't run on Jenkins (environment issue)

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.

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

./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)

However, when I have jenkins set up to run this same command:

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) => {
01:44:46                             ^
01:44:46 SyntaxError: Unexpected token >
etc

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?




Aucun commentaire:

Enregistrer un commentaire