My module has no dependency on its own but for running tests you need to install jasmine-node module. Should I include that module as a dependency?


Most package management systems have a special way of specifying dependencies that are needed only for the development. Python's setuptools has extras_require, Clojure's leiningen has profiles, and npm has devDependencies: see docs.


devDependencies is exactly what you are looking for. However, if this is a package that you only occasionally need, you can use something else.

My npm package is install-subset, and can be installed globally with npm install -g install-subset


First, you build whitelists and blacklists for named install subsets in your package.json like this:

"subsets": { "build": { "whitelist": [ "babel-cli", "dotenv" ] }, "test": { "blacklist": [ "eslint", "lint-rules", "prettier" ] } }

Then call it with, for example, install-subset test

This will temporarily rewrite your package.json to not install those packages blacklisted, then restore it, which depending on the packages can save a lot of time and bandwidth.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.