I am trying to understand what I am doing wrong in this case. 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 run correctly:
$ npm test (successful run)
However, when I try to just run the mocha command, I have it in my package. json
$ mocha --recursive ./src/setup/*.js ./test/**/*.js"
These errors are:
-sh: mocha: command not found
I donβt have mocha globally, I just installed it through npm for this particular project.
If I install mocha globally, then it works. Why doesn't it work when I only have mocha installed in the current node_modules directory, but it works with "npm test"?
source share