This document will guide you through the process of generating new Jest Mocks for packages/jest-expo
module using apps/jest-expo-mock-generator
.
We provide some mocks of our native methods which are generated by traversing all the modules and its methods and making a configuration of all those methods with the number of arguments etc.
- In your terminal, go to
apps/jest-expo-mock-generator
- run
yarn
to ensure the dependencies are installed - run
expo start
to start the Expo server
- Open the Expo Go project on
iOS
by openingios/Exponent.xcworkspace
- run the project on a simulator or a device
-
Open
jest-expo-mock-generator
in the running Expo Go app -
After the app is finished opening, in the terminal, where the Expo server is running, you should see a big chunk of text wrapped with
------------------------------COPY THE TEXT BELOW------------------------------
and
------------------------------END OF TEXT TO COPY------------------------------
lines. Select and copy the text from between those lines.
jest-expo-mocks.mp4
-
Stop the Expo server running in
apps/jest-expo-mock-generator
, started in step 1. -
Paste the copied text into
packages/jest-expo/src/preset/expoModules.js
. -
In the terminal, go into
packages/jest-expo
. -
Run
yarn prettier src/preset/expoModules.js --write
. -
Commit the changes. Bonus points for not modifying mock values (like
deviceYearClass
), which will be different if you use a test device different than the one used before.