-
-
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
[jest-resolve] Add support for packageFilter
for custom resolvers
#10393
Conversation
…t into add/support-for-packageFilter
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.
Thanks!
This needs a test and an example in the docs for how this would be used to check the module
prop
}; | ||
}); | ||
|
||
const mockResolveSync = < |
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.
Full disclosure: I've never used Jest+TS, I don't know if there is a better way of doing this.
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.
Thanks!
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
Forwards option
packageFilter
toresolve
. This is useful in case a custom resolver wants to use it. The best example is #2702 (in particular, #2702 (comment))Fixes #2702
Test plan
Write a custom resolver like
Then, in any jest test, when importing package
X
, it will try to load it from the fieldmodule
first, with fallback tomain
ifmodule
doesn't exist.