testing-library / cypress-testing-library

🐅 Simple and complete custom Cypress commands and utilities that encourage good testing practices.
http://npm.im/@testing-library/cypress
MIT License
1.8k stars 152 forks source link

Consider removing `cypress` as a peer dependency? #216

Open tvsbrent opened 2 years ago

tvsbrent commented 2 years ago

What you did: npm install @testing-library/cypress

What happened: Due to the peerDependencies work in NPM 8, Cypress was installed in the project. However, for our organization's continuous integration pipelines, we use a Docker image that has Cypress installed globally, so this is unnecessary and can introduce CI job fails.

Reproduction repository: n/a

Problem description: As mentioned above, we have Cypress installed in the Docker image used by our CI pipeline. This is to speed up the CI agent runs, as they don't need to download the Cypress binary. This was not a problem with previous versions of NPM, as while it would complain about a missing peer dependency, it wouldn't install that dependency.

With NPM 8, the behavior changed, so unless the --legacy-peer-deps argument is used, Cypress is now installed when this library is installed. This has the effect of slowing down the test run. It also has the potential of introducing errors if the version chosen by NPM is not the same as the version installed globally.

Suggested solution: Could cypress be removed as a peer dependency? I realize that installing Cypress globally is not the recommended practice, but has worked for us. Could the fact the library is named @testing-library/cypress be sufficient to know Cypress is needed?