node.js - mocha running with NPM test but not regular mocha CLI command -


i trying understand doing wrong in instance. have node.js project following in package.json

  "scripts": {     "test": "mocha --recursive ./src/setup/*.js ./test/**/*.js"   },   "dependencies": {      "mocha": "^2.2.5"   } 

when run 'npm test' mocha tests run correctly:

$ npm test (successful run) 

however when try run mocha command have there in package.json

$ mocha --recursive ./src/setup/*.js ./test/**/*.js" 

this errors with:

-sh: mocha: command not found 

i not have mocha globally installed, have installed via npm specific project.

if install mocha globally works. why doesn't work when have have mocha installed in current directory's node_modules, yet 'npm test'?

npm scripts automatically add mocha path:

if depend on modules define executable scripts, test suites, executables added path executing scripts.

https://docs.npmjs.com/misc/scripts#path


Comments

Popular posts from this blog

java - Andrioid studio start fail: Fatal error initializing 'null' -

android - Gradle sync Error:Configuration with name 'default' not found -

StringGrid issue in Delphi XE8 firemonkey mobile app -