I am trying to understand what I am doing wrong in this instance. I have a Node.js project with the following in my package.json
"scripts": { "test": "mocha --recursive ./src/setup/*.js ./test/**/*.js" }, "dependencies": { "mocha": "^2.2.5" } When I run 'npm test' the mocha tests are run correctly:
$ npm test (successful run) However when I try to just run the mocha command I have there in my package.json
$ mocha --recursive ./src/setup/*.js ./test/**/*.js" This errors with:
-sh: mocha: command not found I do not have mocha globally installed, I only have installed it via npm to this specific project.
If I install mocha globally then it works. Why doesn't it work when I have simply have mocha installed in the current directory's node_modules, yet it does with 'npm test'?