I'm following Sails docs and tried to run Mocha tests.
I've edited my package.json
in the way the docs specified, but for some reason when I try to run Mocha I always get EACESS, permission denied error.
At first I got:
Error: EACCES, permission denied '/Library/Application Support/Apple/ParentalControls/Users'
I didn't understand why would it has to do anything with running my tests, but Added the required permission for this folder.
then I got:
Error: EACCES, permission denied '/Library/Application Support/ApplePushService'
Again, didn't understand, so changed the permission on this folder, which didn't help also.
I'm not understanding why would Mocha need permissions on these files , or how to fix it.
I ran the command :
mocha test/bootstrap.test.js test/unit/**/*.test.js
And my project structure is exactly the same as in Sails tutorials.
I'm using [email protected]. My co-worker cloned the repo, and tried to run the tests on his machine, but failed with exactly the same errors.
I tried downgrading to [email protected] Which didn't help also.
The full error trace:
events.js:85
throw er; // Unhandled 'error' event
^
Error: EACCES, permission denied '/Library/Application Support/ApplePushService'
at Error (native)
at Object.fs.readdirSync (fs.js:761:18)
at Glob._readdir (/usr/local/lib/node_modules/mocha/node_modules/glob/glob.js:609:20)
at Glob._process (/usr/local/lib/node_modules/mocha/node_modules/glob/glob.js:393:15)
at Glob.<anonymous> (/usr/local/lib/node_modules/mocha/node_modules/glob/glob.js:427:14)
at Array.forEach (native)
at Glob.<anonymous> (/usr/local/lib/node_modules/mocha/node_modules/glob/glob.js:426:9)
at Glob._afterReaddir (/usr/local/lib/node_modules/mocha/node_modules/glob/glob.js:635:15)
at Glob._readdir (/usr/local/lib/node_modules/mocha/node_modules/glob/glob.js:613:17)
at Glob._process (/usr/local/lib/node_modules/mocha/node_modules/glob/glob.js:393:15)
at Glob.<anonymous> (/usr/local/lib/node_modules/mocha/node_modules/glob/glob.js:427:14)
at Array.forEach (native)
at Glob.<anonymous> (/usr/local/lib/node_modules/mocha/node_modules/glob/glob.js:426:9)
at Glob._afterReaddir (/usr/local/lib/node_modules/mocha/node_modules/glob/glob.js:635:15)
at Glob._readdir (/usr/local/lib/node_modules/mocha/node_modules/glob/glob.js:613:17)
at Glob._process (/usr/local/lib/node_modules/mocha/node_modules/glob/glob.js:393:15)
at Glob.<anonymous> (/usr/local/lib/node_modules/mocha/node_modules/glob/glob.js:427:14)
at Array.forEach (native)
at Glob.<anonymous> (/usr/local/lib/node_modules/mocha/node_modules/glob/glob.js:426:9)
at Glob._afterReaddir (/usr/local/lib/node_modules/mocha/node_modules/glob/glob.js:635:15)
at Glob._readdir (/usr/local/lib/node_modules/mocha/node_modules/glob/glob.js:613:17)
at Glob._process (/usr/local/lib/node_modules/mocha/node_modules/glob/glob.js:393:15)
at Glob.iterator (/usr/local/lib/node_modules/mocha/node_modules/glob/glob.js:171:10)
at Array.forEach (native)
at new Glob (/usr/local/lib/node_modules/mocha/node_modules/glob/glob.js:169:22)
at glob (/usr/local/lib/node_modules/mocha/node_modules/glob/glob.js:57:11)
at Function.globSync (/usr/local/lib/node_modules/mocha/node_modules/glob/glob.js:76:10)
at Object.lookupFiles (/usr/local/lib/node_modules/mocha/lib/utils.js:590:20)
at /usr/local/lib/node_modules/mocha/bin/_mocha:320:30
at Array.forEach (native)
at Object.<anonymous> (/usr/local/lib/node_modules/mocha/bin/_mocha:319:6)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3
npm ERR! Test failed. See above for more details.
I'm not sure if it can help but I had a similar problem : as soon as i typed mocha in my shell, it were failing with a EACCES on a folder outside of my app. :
I found the bug came from file ./test/mocha.opt were i wrote a comment from sails.js docs :