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.
- Go to
apps/jest-expo-mock-generator
- make sure it's
yarn
ed - run the Expo project (
expo start
)
- Open Expo Client project on
iOS
usingios/Exponent.xcworkspace
- run project on the device
-
Open
jest-expo-mock-generator
inExpo Client
-
Copy big output that is printed between lines
------------------------------COPY THE TEXT BELOW------------------------------
and
------------------------------END OF TEXT TO COPY------------------------------
.
- Paste/Save the above output into some file. DO NOT COMMIT THIS FILE! 😅 Clean after yourself!
OSX command:
pbpaste > expoModules.txt
- Run
node prettify-output <filename containing output from logs>
oryarn prettify-output
.
OSX command:
yarn prettify-output expoModules.txt
- Copy results that are written in
<output filename from previous commands with .js extension
OSX command:
cat expoModules.js | pbcopy
- Paste it into
packages/jest-expo/src/expoModules.js
or just replace this file with new one.
OSX command:
mv expoModules.js ../../packages/jest-expo/src/preset/
- Clean after yourself in
jest-expo-mock-generator
and submit PR with changes.