testing-library-docs icon indicating copy to clipboard operation
testing-library-docs copied to clipboard

Revert "Add peer dependency to User Event docs"

Open nickserv opened this issue 2 years ago • 8 comments

Reverts #888

user-event's recommendation for installing dom appears to be outdated, as package managers (except npm 3-6 and Yarn) automatically install dependencies anyway.

nickserv avatar Oct 28 '23 20:10 nickserv

Deploy Preview for testing-library ready!

Name Link
Latest commit dc939364a68eda58e6c5c166ca46afa9faca6c67
Latest deploy log https://app.netlify.com/sites/testing-library/deploys/654d85be1f9bb10008b69995
Deploy Preview https://deploy-preview-1329--testing-library.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] avatar Oct 28 '23 20:10 netlify[bot]

AFAIU from the code, @testing-library/dom is still a peer dependency, doesn't that mean we still need that? I understand that if a user installs @testing-library/react for example they'll have it installed but if a user only installs user-event, this might still be needed don't you think?

MatanBobi avatar Oct 29 '23 07:10 MatanBobi

Not likely since npm 7 installs peer dependencies automatically (again).

Context: I just checked blame and this was apparently my fault. 😅 At the time npm 7 was new so I couldn't depend on peer dependencies being installed automatically. Now npm 7 has been included with Node for 3 years and support for older releases ended 6 months ago, so I'm not as concerned about compatibility. If a user has a package manager that doesn't install peer dependencies (including npm 3-6 and Yarn), it will still warn by default.

nickserv avatar Oct 30 '23 18:10 nickserv

Since people don't really care about the warnings from the npm i script, maybe we can add a note about that for old users?

MatanBobi avatar Oct 31 '23 07:10 MatanBobi

A note about what? Can you give an example?

nickserv avatar Nov 02 '23 19:11 nickserv

A note about what? Can you give an example?

That explicitly installing @testing-library/dom is still needed if you're using npm < 7. Since user-event doesn't have an engines definition and @testing-library/react for example still support node 14 which originally was bundled with npm 6. That's just an idea, you can ignore it if you don't think it's needed :)

MatanBobi avatar Nov 02 '23 20:11 MatanBobi

Our engines are out of date because Node 16 support was recently dropped, but I'll make sure this is fixed soon and users should have already upgraded Node for security reasons anyway.

I'd really prefer to keep the original revert of my change (the first commit in this pull ignoring formatting changes) as it's now outdated advice and it's not even consistent with User Event's readme. If you have any strong opinions against this please say so, preferably with explicit examples of potentially problematic use cases.

nickserv avatar Nov 02 '23 20:11 nickserv

Our engines are out of date because Node 16 support was recently dropped, but I'll make sure this is fixed soon and users should have already upgraded Node for security reasons anyway.

I'd really prefer to keep the original revert of my change (the first commit in this pull ignoring formatting changes) as it's now outdated advice and it's not even consistent with User Event's readme. If you have any strong opinions against this please say so, preferably with explicit examples of potentially problematic use cases.

We'll probably update those once the major version for DTL will merged. I understand, I'm good with that :)

MatanBobi avatar Nov 03 '23 09:11 MatanBobi