Cheerio Update to 1.0.0 is breaking Enzyme 3.11.0 for Node < 18.17.0
RaghavAgrawal-TUL-Luxury opened this issue · 7 comments
Currently, on npm registry Enzyme@3.11.0 dependencies look like this:
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
- Webpack build issues
- Cannot find module 'react-dom/lib/ReactTestUtils'
- Query Selector fails
- Testing third party libraries
If you haven't found any duplicated issues, please report it with your environment!
Current behavior
Expected behavior
Your environment
API
- shallow
- mount
- render
Version
library | version |
---|---|
enzyme | |
react | |
react-dom | |
react-test-renderer | |
adapter (below) |
Adapter
- enzyme-adapter-react-16
- enzyme-adapter-react-16.3
- enzyme-adapter-react-16.2
- enzyme-adapter-react-16.1
- enzyme-adapter-react-15
- enzyme-adapter-react-15.4
- enzyme-adapter-react-14
- enzyme-adapter-react-13
- enzyme-adapter-react-helper
- others ( )
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.
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" }
Why was this closed as "not planned"? Will there no longer be any fixes for this library?
@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.
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)
@hanamantk theres no other option, since rc3 is the last cheerio version that’s compatible with enzyme.