未能用帆进行摩卡测试

Omr*_*tix 6 unit-testing mocha.js node.js sails.js

我正在关注Sails文档并尝试运行Mocha测试.我package.json按照文档指定的方式编辑了我,但出于某种原因,当我尝试运行Mocha时,我总是得到EACESS,权限被拒绝错误.

起初我得到了:

Error: EACCES, permission denied '/Library/Application Support/Apple/ParentalControls/Users'
Run Code Online (Sandbox Code Playgroud)

我不明白为什么它必须对运行我的测试做任何事情,但添加了此文件夹所需的权限.

然后我得到了:

Error: EACCES, permission denied '/Library/Application Support/ApplePushService'
Run Code Online (Sandbox Code Playgroud)

再次,不明白,所以改变了这个文件夹的权限,这也没有帮助.

我不明白为什么Mocha需要对这些文件的权限,或者如何解决它.

我跑了命令:

mocha test/bootstrap.test.js test/unit/**/*.test.js
Run Code Online (Sandbox Code Playgroud)

我的项目结构与Sails教程完全相同.

我正在使用Mocha@2.2.5.我的同事克隆了回购,并试图在他的机器上运行测试,但失败了完全相同的错误.

我尝试降级到Mocha@2.2.0,这也没有帮助.

完整的错误跟踪:

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.
Run Code Online (Sandbox Code Playgroud)