-
-
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
Remove support for @providesModule #6104
Remove support for @providesModule #6104
Conversation
Let's not merge that one until I finish upgrading internally. There's too much flakiness already and I don't want to deal with more. |
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 looks great, very nice work! Can you make sure react-native open source (which has a jest-preset.json in the react-native-github folder) is properly set up to extract haste names same as Metro (if it isn't already)
@mjesun this shouldn't affect FB as we use a custom hasteImpl already.
The more commits we add, the harder is to discover what breaks. And it's already quite hard. |
954713a
to
ee36091
Compare
@cpojer thanks! React Native, Relay and Draft.js already have a |
Yes, that's true for React Native but not for the Jest config created for React Native projects, see https://github.com/facebook/react-native/blob/master/jest-preset.json#L2-L8 which should have a hasteImpl specified. |
@cpojer oh, for projects using React Native. Got It! Thanks! |
a6c03ea
to
5c45921
Compare
Integration tests are failing because the React Native version that works without @providesModule hasn't been released yet. |
@rubennorte understood, however merging this would make all builds crash. Can we duplicate or make a patch to the existing RN tests? |
You could make the RN tests pass by providing a custom hasteImpl for now and then upgrade the dep later, right? |
fbjs is still using @providemodules: https://github.com/facebook/fbjs/blob/master/packages/fbjs/src/__forks__/invariant.js#L7 This is probably causing e2e tests to fail on the react-native repo. The custom hasteModule implementation in RN does not handle prodvidemodule annotations inside node_modules directory. I'm not sure what's the best way to move forward. maybe upgrade fbjs and handle providemodules inside node_modules? |
cc @rubennorte ^ |
Thanks to @chirag04 for the heads up. I'm looking into a failing snapshot test in React Native when Jest 23.0.0-charlie.2 is used, which may be related to this issue (I'm still investigating): facebook/react-native#19308 Any ideas on how to move forward? |
@chirag04 even though we're removing support for I'm pretty sure the e2e errors you're pointing out aren't caused by this change but by an issue when not using Watchman. |
As far as I can tell, all the test failures for RN (in the linked issue, at least) are due to #6162 |
the latest react-native source has removed |
Thank you for your pull request. We require contributors to sign our Contributor License Agreement, and yours has expired. Before we can review or merge your code, we need you to email cla@fb.com with your details so we can update your status. |
@rubenmoya @mjesun @hramos what's the status of this diff? |
I'm pretty sure you meant to ping @rubennorte 😂 |
Damn you GitHub autocomplete! 😅 |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
@rubennorte any news on this? Next release is a major, so would be nice to land in it |
@SimenB I'm working on some changes to jest-haste-map. I'll work on this again once I finish that. |
8c902d4
to
6631437
Compare
6631437
to
2e2627d
Compare
433cfab
to
9a1ef9a
Compare
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.
LGTM!
9a1ef9a
to
92c5e04
Compare
1c1c958
to
8609efe
Compare
Codecov Report
@@ Coverage Diff @@
## master #6104 +/- ##
==========================================
+ Coverage 66.6% 66.63% +0.03%
==========================================
Files 253 253
Lines 10629 10617 -12
Branches 4 4
==========================================
- Hits 7079 7075 -4
+ Misses 3549 3541 -8
Partials 1 1
Continue to review full report at Codecov.
|
@rubennorte thoughts on the test added in #6687? As far as I can tell it only works because it depends on |
@SimenB I think that test is wrong right now because the local |
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
@providesModule
is an undocumented Jest feature that some packages (mostly internally at Facebook) used to use. Most of this packages don't use it anymore, so we can stop supporting it by default and enable it viahasteImplModulePath
if anyone requires it (it receives the filename, so it can read the file to extract any@providesModule
annotation).This will also allow
jest-haste-map
to stop reading the contents of the files if consumers don't need the dependency list (like Metro). This should be implemented as an option (e.g.extractDependencies: boolean
) in a following PR.Test plan
All Jest tests have been updated so running them and building the project should be enough.