jest
jest copied to clipboard
[Feature]: Upgrade jest-environment-jsdom dependency to jsdom@^25.0.1
🚀 Feature Proposal
For package jest-environment-jsdom, change dependency on jsdom from: "jsdom": "^22.0.0" to "jsdom": "^25.0.1"
Motivation
jsdom versions before 25.0.1 (including 25.0.0) indirectly rely on punycode which is deprecated and emits deprecation warnings for every test.
A more detailed explanation can be found on this older issue which was closed without addressing (although I believe it needs to be ugpraded all the way up to v25): https://github.com/jestjs/jest/issues/15148
Example
No response
Pitch
The package already relies on jsdom, this is just requesting an upgrade of one of its dependencies.
I currently use a dependency override and the behavior is fully preserved. Of course, I have a limited set of tests so I'm not sure that there is no impact but it is possible that this is a very small effortless change. While the override does handle my issue, overrides are always a little dangerous and I think it would be good for the lib to not rely on deprecated code.
Further motivation: a number of APIs are missing in older jsdom versions that were recently added, e.g. crypto.randomUUID() added in [email protected]
As a side-note, the current latest [email protected] depends on jsdom@^20.0.0 (not 22.0.0 as mentioned in the original issue post).
As a follow-on to the above side-note, including jsdom@^20.0.0 also has the side effect of pulling deprecated code like abab and outdated versions of data-urls ...
+1. it looks like the latest alpha still has jsdom 22. But v23 is the first one without the deprecated abab and domexception packages.
% npm install -D jest jest-environment-jsdom @testing-library/react @testing-library/dom @testing-library/jest-dom
npm warn deprecated [email protected]: Use your platform's native atob() and btoa() methods instead
npm warn deprecated [email protected]: Use your platform's native DOMException instead
% npm ls abab
[email protected] /Users/dolan/IdeaProjects/todo-heap
└─┬ [email protected]
└─┬ [email protected]
├── [email protected]
└─┬ [email protected]
└── [email protected] deduped
% npm ls domexception
[email protected] /Users/dolan/IdeaProjects/todo-heap
└─┬ [email protected]
└─┬ [email protected]
└── [email protected]
Versions of jsdom below 24.1.2 rely on a vulnerable version of ws package. https://nvd.nist.gov/vuln/detail/CVE-2024-37890.
How about giving this issue a bit more focus like changing it from a Feature Request to a Bug?
even renovate wants this https://github.com/jestjs/jest/pull/15276
Any updates on this? We are still seeing this message on every one of our test suite runs:
(node:10249) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
It's rather annoying.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days.
I would still like this to be fixed, so... it's not stale to me
With jsdom@^26.0.0 "Error: Could not parse CSS stylesheet" when css @layer rule is used would also be fixed...
+1. this would fix all the above mentioned issues and more. please upgrade this dependency
Hey folks, does anyone here know how to get the attention of people in this repo? It seems like a lot of people want this? It also seems like the last change to this package was 5 months ago (the repo is still being worked on though).
@ThomasGreenspan would you mind updating the jsdom version in the issue title to latest (v26.0.0)? This would also get rid of the issue @it11ah1 mentioned, which is a thing if you used the latest @angular/cdk
https://github.com/jestjs/jest/issues/15217#issuecomment-2254474396
https://github.com/jestjs/jest/pull/15473
If the reason for closing is that jest doesn't want to drop support for node@16 ... then how come this could be a thing: https://github.com/jestjs/jest/pull/15461 And if that's not the reason, then @SimenB please give more details as to why this feature request has been closed? Especially given the fact that a PR is already open for the topic.
Hi all, not sure if the jest package maintainers will approve / merge my PR (due to several breaking changes).
I built a custom jest environment in the meantime to help us all out.
Feel free to play around with it: https://github.com/andreibereczki/jest-environment-jsdom-twentysix
If something doesn't work, please drop me a message and i'll look into it.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.