-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
[jest-resolve] Add support for packageFilter for custom resolvers
#10393
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
Conversation
…t into add/support-for-packageFilter
SimenB
left a comment
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.
SimenB
left a comment
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
packageFiltertoresolve. 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 fieldmodulefirst, with fallback tomainifmoduledoesn't exist.