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?

- 1,970
- 3
- 22
- 32
2 Answers
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
https://www.npmjs.com/package/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.

- 121
- 1