New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#697@patch: Upgrade jest dependencies to 29.4.0. #698
#697@patch: Upgrade jest dependencies to 29.4.0. #698
Conversation
In my opinion this should have been solved in a different way. I would have preferred this just become a series of peerDependencies, instead of dependencies. You would then update the installation steps to be the following.
There's nothing in the class that really cares about what versions of jest is being used. So why force users to a particular jest version just to use happy dom? Thoughts @ahuth? Note: This still working with jest 27 is maybe just a happy coincidence (it means someone running jest 27 is using jest 29 for the other packages which might not work for all aspects of jest but 99%), but will probably result in it breaking again on Jest 30, where peerDependencies will probably "just work" as consumers would update all of their jest dependencies as they increment versions. |
"jest-util": "^27.5.1", | ||
"@jest/environment": "^29.4.0", | ||
"@jest/fake-timers": "^29.4.0", | ||
"@jest/types": "^29.4.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jest/types
shouldn't be a dependency, it needs to be a devDependency so that it's not installed for end users of the package (it's only here for type information).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same goes for @jest/environment
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jereklas I think @jest/environment
has to be a dependency here. @jest/types
can be a dev dependency.
I see where you're coming from, @jereklas. But I don't think peer deps makes sense here. To use Jest I'd expect to have to install
Not the fake timers, mocking, utils, other jest sub-packages, etc. In fact, both Maybe it would be clearer if @happy-dom/jest-environment had the same major version number as the version of Jest it worked with. Or at least if updating Jest to a new major version here was a breaking change.
For sure. Definitely a possibility that a future version of Jest breaks it. Or even just being mismatched (using jest v27 but jest-mock v29) is a bit weird (even if it works currently). |
I guess chalk it up to a difference of opinion of how dependencies are managed. At the end of the day, I have a workaround irrespective of how this gets resolved that can allow me to have all versions of the packages align to exactly the versions I want (using pnpm to override what the package.json file says to install). Below are a continuation of my opinion, feel free to skip over if you'd like :) I would much rather be told to install 2-3 more things upon installation so that I have control over keeping everything used by my tooling version aligned, then hope for everything to "magically" work today while all versions are aligned, and then fail tomorrow when they're no longer aligned. To continue my concerns, updating to ^29.4.0 and working with 27.x.x is "working" only because the v28 and v29 versions support enough of the This just speculation, but I wouldn't be surprised at all if 90% of Jest usages just work with Jest 27.x.x being used with the 29.x.x support packages, but then there could be ~10% of Jest that flat out fail, and those users will be stuck wondering why this package doesn't work. All of the above happens because people don't actually know what their dependencies are, and having someone install more of them while slightly a pain, at least makes everything less "magic". |
@jereklas @ahuth it happens that Jest changes how the environment is implemented. It has happened a couple of times in the past. One solution would be to split out Maybe this should be handled in a separate ticket in that case? I have created #703 for it. |
👍 Makes sense to me |
Fixes #697 by upgrading all jest dependencies (especially the ones in @happy-dom/jest-environment) to 29.4.0.
I also verified that @happy-dom/jest-environment works when being used in Jests v27 and v29.