Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should jest/enzyme be a devDependency or dependency

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.

like image 240
Adeel Imran Avatar asked Jun 21 '19 14:06

Adeel Imran


People also ask

Should ESLint be a dev dependency?

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 !

What is the difference between dependency and devDependency?

A dependency is a library that a project needs to function effectively. DevDependencies are the packages a developer needs during development.


1 Answers

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.

like image 68
Ali S. 'Salam Avatar answered Oct 02 '22 17:10

Ali S. 'Salam