-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
[Bug]: Enforcing import assertions should have been a BREAKING CHANGE, made worse by inability to pin jest to a specific version, (and made yet worse by TC39's decision to demote import-assertions to stage 2) #13909
Comments
In thinking further about this, I believe semver provides clear direction for how to proceed here:
So... revert the import assertions changes (#12755 & #13805) and roll out as a patch release (ASAP)? And possibly |
Yeah, I noticed it being "demoted". Unlucky timing for us 😅 Reverting seems sensible. Would you be up for sending a PR? Issue 2 is a long-standing (and, imo, separate) one. We have an issue somewhere - I'm down to lock down our monorepo deps so versioning is easy to lock down. |
Put up #13911 (but need help resolving lint errors).
Will this involve more than turning off semver |
Yeah, code change for exact versions is pretty simple - hasn't been done due to some folks preferring current approach. |
Let me guess... something to do with minimizing I guess I can respect that but, damn, it's a pain in the ass when something like this crops up. |
correct 😀 |
Note that at least |
TIL. I'm going to have to ponder how that affects dependency management workflows. 'Feels like the sort of thing that works in theory ("it lets you establish your dependencies in a lockfile"), but maybe not so well in practice ("lockfiles get rebuilt all the time"). Regardless, this is good to know, thanks! |
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. |
Version
29.4.2 (i.e. latest)
Steps to reproduce
[My apologies for a long report here but as the title says, I've run into multiple related issues that I think are best presented as a whole.]
Setup: Create a directory with the following three files:
package.json
data.json
index.spec.js
Issue 1: Releasing a BREAKING CHANGE in a minor update
From the release notes, version 29.4.0 introduced this change:
In the directory you've just created...
As expected from the release notes, the test fails due to the missing import assertion. But this used to work in previous minor versions! For example ...
Wait, what?!? I specifically installed v29.3. Why do I still have 29.4.2??
This brings us to ...
Issue 2: Can't install previous minor versions of
jest
Apparently this is a thiing with
jest
? No matter what minor version you install, you end up getting the latest minor version for it?npm i [email protected]
installs27.5.1
?npm i [email protected]
installs28.1.3
?I won't bore you with the details, but for others who might be reading this, it has to do with how
jest
is just a thin wrapper around a whole ecosystem of "...jest...
" modules that all depend on semver "^
"-prefixed dependencies, and how that manifests when installing modules.This is both unexpected and magical. And, in the case of issue 1, above, not a little bit painful. It mean there's no viable way of reverting to the most recent version of
jest
that didn't have this behavior (v29.3.1). The most recent "pinnable" version is v28.1.3, which breaks stuff for a bunch of other reasons.Still with me? 😄
We can, however, sort of revert to 29.3.1 by manually overriding everything via NPM's
overrides
feature. To do so, add the followingoverrides
section to thepackage.json
file:This is the very definition of "fugly" - so much so I don't see being able to justify doing this as part of a real project - but it gets the job done for testing purposes here ...
**NOTICE: Our test passes under
29.3.1
... meaning (and I hope you'll agree) that this does in fact represent a BREAKING CHANGE which should have been released asv30
.Issue 3: Import assertions have been demoted from TC39 stage 3 back to stage 2
To complicate matters further, while poking around with this issue, I noticed this statement that TC39 added to the
import-assertions
README a couple days ago:Expected behavior
jest
to specific minor versionsI'll leave it at this, as I expect you folks will have already discussed some of this, or need to discuss this further.
Actual behavior
See previous sections...
Additional context
No response
Environment
The text was updated successfully, but these errors were encountered: