-
-
Notifications
You must be signed in to change notification settings - Fork 115
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
Make jest-environment-jsdom a peerDependency in jest-environment-enzyme #343
base: master
Are you sure you want to change the base?
Conversation
It could still not have been upgraded right away - peerdeps are strict requirements, and if npm ls does not exit zero, your dep graph is invalid and you can’t rely on anything working. npm 7 will fail installs if your peer deps are invalid. That said, it should indeed be a peer dep. |
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.
It will need to be both a peer dep and a dev dep, or else tests can’t pass.
@@ -43,12 +43,10 @@ | |||
"peerDependencies": { | |||
"enzyme": "3.x", | |||
"jest": ">=22.0.0", | |||
"react": "^0.13.0 || ^0.14.0 || ^15.0.0 || >=16.x" | |||
"react": "^0.13.0 || ^0.14.0 || ^15.0.0 || >=16.x", | |||
"jest-environment-jsdom": ">=22.0.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.
This shouldn’t use >=, because you can’t guarantee compact with future majors.
"jest-environment-jsdom": ">=22.0.0" | |
"jest-environment-jsdom": "^25.2.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.
I was following the precedent already set by the jest
peer dependency in jest-enzyme
with using the >=
. Should we also change the jest
peer dependencies?
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.
Oof, true enough.
Ideally yes, jest should be using ^22 || ^23
etc, and that should probably match this line.
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.
However, changing the jest peer dep like that is a breaking change at this point - but so is adding a new peer dep.
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.
In an idealistic world I completely agree with you. However on a more practical level, it's situations like reduxjs/redux-devtools#473 (one example of many in my experience) that cause me to want to be more permissive.
@blainekasten What do you think? What do you want the the peer dependency ranges to be?
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.
@ljharb I made a PR to tighten peer dependency ranges: #344. If that PR gets merged before this one, then I'll gladly update the dependency range here. Otherwise, if this PR gets merged first, then I'll fix it in the other PR.
Since the >=
is consistent with the status quo, I think it should be fine for this PR to be merged as-is. Conversation about the version ranges can happen on the other PR.
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.
I don't think consistency is as important here as getting the range of a new peer dep correct; while it's not up to me, i wouldn't merge it with >=
.
@ljharb |
What's the status of this? |
This increases flexibility for developers using this package. For example, I've been waiting for a couple months to upgrade to Jest 25 (see #334). If this were a peer dependency, then I could have upgraded right away and it would have just automatically used the new version of
jest-environment-jsdom
.