Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Permission denied when running npm test via mocha on Travis-CI

I'm setting up a simple NodeJS application which I'm integrating with Travis-CI. I'm using Mocha to help with my tests. However, while these tests run fine locally, I'm failing the tests when on Travis-CI before deploying to Openshift. Some help on figuring this out would be cool =)

Travis-CI output

[email protected] test /home/travis/build/melvrickgoh/CAT
> mocha test/ 
sh: 1: mocha: Permission denied
npm ERR! Test failed.  See above for more details.
npm ERR! not ok code 0

This is what is have inside my package.json

"scripts": {
    "start": "node app.js --websocket-port=$OPENSHIFT_NODEJS_PORT --log-level=1",
    "test": "mocha test/ "
  },
like image 690
Melvrick Goh Avatar asked Jun 23 '14 11:06

Melvrick Goh


2 Answers

Same issue, adding this to my .travis.yml this fixed it for me:

before_script: chmod 0777 ./node_modules/.bin/mocha
like image 53
Nathan Boyd Avatar answered Oct 05 '22 10:10

Nathan Boyd


Had same issue on OpenShift when trying to run tests. Solved by making the the mocha file executable, as follows:

chmod 0777 /var/lib/openshift/53ef9c315973cabb00034c/app-root/runtime/repo/node_modules/.bin/mocha
like image 29
Milan Avatar answered Oct 05 '22 11:10

Milan