Skip to content

Commit 6e1a46c

Browse files
committed
[jest] Explicitly separate mocked native modules from mocked JS modules
This commit more clearly defines the mocks RN sets up and uses paths instead of Haste names to define the mocks. The Jest setup script defined mocks for native modules (Obj-C, Java) and mocks for JS modules in the same data structure. This meant that some non-native modules (that is, JS modules) were in the `mockNativeModules` map -- this commit splits them out and mocks them in typical `jest.mock` fashion. Additionally, the setup script used to mock the modules using the Haste names. As one of the steps toward migrating to standard path-based imports, the setup script now mocks JS modules using paths (native modules don't need a Haste name nor path since they are just entries in `NativeModules`). This gets us closer to being able to remove `hasteImpl`. Also, this commit removes mocks that are not referenced anywhere in the RN and React repositories (grepped for the names and found no entries outside of the Jest setup scripts). Test plan: Ran all unit tests to ensure they pass. Additionally copied the RN setup script into `jest-expo`, which tests some more complex mocking setups with view manager and all tests passed without any modification to `jest-expo`.
1 parent 55db1d0 commit 6e1a46c

File tree

1 file changed

+203
-252
lines changed

1 file changed

+203
-252
lines changed

0 commit comments

Comments
 (0)