-
-
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
feat: support .
in exports
field
#11919
Conversation
a94160b
to
135e19b
Compare
I think this is ready now. One issue is that if the user provides a |
@@ -6,13 +6,9 @@ | |||
"mjs", | |||
"json" | |||
], | |||
"resolver": "<rootDir>/resolver.js", |
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.
we don't need this anymore as this just tests that the condition node
, browser
etc of the main entry point are supported, and since we add support to jest itself for the entry point (and the things we test don't have a main
), the rest works.
resolver: require.resolve('../__mocks__/userResolver'), | ||
}); | ||
|
||
expect(mockResolveSync).toHaveBeenCalledWith( |
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.
since we now wrap the function, it's not actually passed as is through, so I had to make some changes so packageFilter
is actually called and assert on that
Hmm, the change I had to make in the last commit worries me. This module used to work since there's a While this is probably fine in most cases, it might mean we must wait with this PR until Jest 28 as well... Or at least we need to consider adding EDIT: Some misunderstandings here - we should always check if file resolved from |
142df6d
to
601e494
Compare
Codecov Report
@@ Coverage Diff @@
## main #11919 +/- ##
==========================================
+ Coverage 68.72% 68.74% +0.02%
==========================================
Files 323 323
Lines 16631 16649 +18
Branches 4799 4805 +6
==========================================
+ Hits 11429 11445 +16
- Misses 5169 5171 +2
Partials 33 33
Continue to review full report at Codecov.
|
601e494
to
96ee934
Compare
OK, added a condition that if there is an We need to pass the |
we return early above if this is the case
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
If we don't have a
main
field, let's attempt to set it to the result of resolving.
(i.e. "main" entry of package) if it exists. Since we do nothing unlessmain
is already missing I think this is a safe thing to do and it's not a breaking change. Can revert and land for Jest 28 if it proves to be breaking, though.Ref #9771 (comment)
Test plan
Tests added