enzymejs / enzyme

JavaScript Testing utilities for React
https://enzymejs.github.io/enzyme/
MIT License
19.95k stars 2.01k forks source link

Cheerio Update to 1.0.0 is breaking Enzyme 3.11.0 for Node < 18.17.0 #2606

Closed RaghavAgrawal-TUL-Luxury closed 2 months ago

RaghavAgrawal-TUL-Luxury commented 2 months ago

Currently, on npm registry Enzyme@3.11.0 dependencies look like this: Screenshot 2024-08-12 at 12 11 09 PM

This caret(^) symbol which is updating the cheerio version for all users is breaking for our application.

Thanks for reporting an issue to us! We're glad you are using and invested in Enzyme. Before submitting, please read over our commonly reported issues to prevent duplicates!

All common issues

Notoriously common issues

If you haven't found any duplicated issues, please report it with your environment!

Current behavior

Expected behavior

Your environment

API

Version

library version
enzyme
react
react-dom
react-test-renderer
adapter (below)

Adapter

RaghavAgrawal-TUL-Luxury commented 2 months ago

In the 'master' branch, the version of cheerio package is changed to "=1.0.0-rc.3", which is not updated in the npm registry, so publishing this change should fix the issue for older projects using node < 18.17.0.

RaghavAgrawal-TUL-Luxury commented 2 months ago

Meanwhile, the solution for this is to add the following in package.json:

For yarn: "resolutions": { "cheerio": "1.0.0-rc.3" }

For npm: "overrides": { "cheerio": "1.0.0-rc.3" }

ljharb commented 2 months ago

Duplicate of #2558.

EJLearner commented 2 months ago

Why was this closed as "not planned"? Will there no longer be any fixes for this library?

ljharb commented 2 months ago

@EJLearner it wasn't, it was closed as a duplicate. See the issue it duplicates, which is fixed, and the next release of enzyme will include it.

On Github, issues are closed when the fix lands, not when the fix is published.

hanamantk commented 2 months ago

Meanwhile, the solution for this is to add the following in package.json:

For yarn: "resolutions": { "cheerio": "1.0.0-rc.3" }

For npm: "overrides": { "cheerio": "1.0.0-rc.3" }

@RaghavAgrawal-TUL-Luxury But cheerio: 1..0.0.rc.3 (rc-release candidate not recommended for production so what is the fix for prod i dont want to upgrade node version so)

ljharb commented 2 months ago

@hanamantk theres no other option, since rc3 is the last cheerio version that’s compatible with enzyme.