Should testing libraries being used in frontend like jest
, enzyme
or react-testing-library
be part of dependencies
or devDependencies
in your package.json
?
Since testing is not part of your build compilation I think it should be in devDependencies
but your testing suites run mostly in your pipelines while being deployed on server i.e, Jenkins, TravisCI etc. Which makes me wonder since it's being used in production shouldn't these be listed in dependencies
section.
Thank you for reading this question.
Packages like ESLint are always a devDependency … unless, of course, you're building a CLI whose job is running ESLint, in which case you'd add it as a dependency !
A dependency is a library that a project needs to function effectively. DevDependencies are the packages a developer needs during development.
devDependencies are modules which are only required during development, while dependencies are required during runtime. Jest/Enzyme are only required during development , therefore should be saved as devDependencies.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With