I understand npm scripts adds ./node_modules/.bin
to your PATH
, therefore you can simply run npm test
using the package.json
below, and npm will automagically use the local version of mocha found in ./node_modules/.bin
"scripts": {
"test": "mocha"
}
This is a nice feature, because it saves me writing package.json
files like this:
"scripts": {
"test": "./node_modules/.bin/mocha"
}
BUT what if I bring on a new developer who has mocha installed globally? or I need to push this to an environment with preconfigured global packages? If I am using the short-hand mocha
, rather than ./node_modules/.bin/mocha
in my package.json
, What takes precedence, the global or local package?
via Chris
No comments:
Post a Comment