node.js - failure to run mocha tests with sails -


i'm following sails docs , tried run mocha tests. i've edited package.json in way docs specified, reason when try run mocha eacess, permission denied error.

at first got:

error: eacces, permission denied '/library/application support/apple/parentalcontrols/users' 

i didn't understand why has running tests, added required permission folder.

then got:

error: eacces, permission denied '/library/application support/applepushservice' 

again, didn't understand, changed permission on folder, didn't also.

i'm not understanding why mocha need permissions on these files , or how fix it.

i ran command :

mocha test/bootstrap.test.js test/unit/**/*.test.js 

and project structure same in sails tutorials.

i'm using mocha@2.2.5. co-worker cloned repo, , tried run tests on machine, failed same errors.

i tried downgrading mocha@2.2.0 didn't also.

the full error trace:

events.js:85       throw er; // unhandled 'error' event             ^ error: eacces, permission denied '/library/application support/applepushservice'     @ error (native)     @ object.fs.readdirsync (fs.js:761:18)     @ glob._readdir (/usr/local/lib/node_modules/mocha/node_modules/glob/glob.js:609:20)     @ glob._process (/usr/local/lib/node_modules/mocha/node_modules/glob/glob.js:393:15)     @ glob.<anonymous> (/usr/local/lib/node_modules/mocha/node_modules/glob/glob.js:427:14)     @ array.foreach (native)     @ glob.<anonymous> (/usr/local/lib/node_modules/mocha/node_modules/glob/glob.js:426:9)     @ glob._afterreaddir (/usr/local/lib/node_modules/mocha/node_modules/glob/glob.js:635:15)     @ glob._readdir (/usr/local/lib/node_modules/mocha/node_modules/glob/glob.js:613:17)     @ glob._process (/usr/local/lib/node_modules/mocha/node_modules/glob/glob.js:393:15)     @ glob.<anonymous> (/usr/local/lib/node_modules/mocha/node_modules/glob/glob.js:427:14)     @ array.foreach (native)     @ glob.<anonymous> (/usr/local/lib/node_modules/mocha/node_modules/glob/glob.js:426:9)     @ glob._afterreaddir (/usr/local/lib/node_modules/mocha/node_modules/glob/glob.js:635:15)     @ glob._readdir (/usr/local/lib/node_modules/mocha/node_modules/glob/glob.js:613:17)     @ glob._process (/usr/local/lib/node_modules/mocha/node_modules/glob/glob.js:393:15)     @ glob.<anonymous> (/usr/local/lib/node_modules/mocha/node_modules/glob/glob.js:427:14)     @ array.foreach (native)     @ glob.<anonymous> (/usr/local/lib/node_modules/mocha/node_modules/glob/glob.js:426:9)     @ glob._afterreaddir (/usr/local/lib/node_modules/mocha/node_modules/glob/glob.js:635:15)     @ glob._readdir (/usr/local/lib/node_modules/mocha/node_modules/glob/glob.js:613:17)     @ glob._process (/usr/local/lib/node_modules/mocha/node_modules/glob/glob.js:393:15)     @ glob.iterator (/usr/local/lib/node_modules/mocha/node_modules/glob/glob.js:171:10)     @ array.foreach (native)     @ new glob (/usr/local/lib/node_modules/mocha/node_modules/glob/glob.js:169:22)     @ glob (/usr/local/lib/node_modules/mocha/node_modules/glob/glob.js:57:11)     @ function.globsync (/usr/local/lib/node_modules/mocha/node_modules/glob/glob.js:76:10)     @ object.lookupfiles (/usr/local/lib/node_modules/mocha/lib/utils.js:590:20)     @ /usr/local/lib/node_modules/mocha/bin/_mocha:320:30     @ array.foreach (native)     @ object.<anonymous> (/usr/local/lib/node_modules/mocha/bin/_mocha:319:6)     @ module._compile (module.js:460:26)     @ object.module._extensions..js (module.js:478:10)     @ module.load (module.js:355:32)     @ function.module._load (module.js:310:12)     @ function.module.runmain (module.js:501:10)     @ startup (node.js:129:16)     @ node.js:814:3 npm err! test failed.  see above more details. 

take @ sails.js test example. think may you.

as in code shown below, refer test/bootstrap.js.

var sails = require('sails'); var _ = require('lodash') global.domain = 'http://localhost'; global.port = 1420; global.host = domain + ':' + port; before(function(callback) {   this.timeout(7000);    var configs = {     log: {       level: 'info'     },     connections: {       memory: {         // lets use memory tests ...         adapter   : 'sails-memory'       }     },     models: {       connection: 'memory'     },     port: port,     environment: 'test',      // @todo needs suport csrf token     csrf: false,      // dont need configs in api test     hooks: {       grunt: false,       socket: false,       pubsub: false     }   };    sails.load(configs, function(err, sails) {     if (err) {       console.error(err);       return callback(err);     }      console.log('rodo!')     // here can load fixtures, etc.     callback(err, sails);   }); });  after(function(done) {   // here can clear fixtures, etc.   sails.lower(done); }); 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -