UNPKG

1.96 kBMarkdownView Raw
1# Contributing
2
3[Here's a video walkthrough of the morpher that should help you understand its
4internals - February 2018](https://youtu.be/iUAxvYi3MJo).
5
6## How do I debug the morpher locally?
7
81. You need to symlink your local morpher to your Views project.
9
10 * In your local instance of the morpher run `yarn link` in the root directory.
11 * In your project where you are using Views run `yarn link @viewstools/morph` in the root directory.
12
132. Put in your `debugger` statements where necessary.
14
153. Run `yarn prepare` in the morpher directory to bundle your code.
16
174. In your views project run `node --inspect ./node_modules/@viewstools/morph/cli.js . --watch`. This will watch your current directory. If you just want to watch a subdirectory within that you can replace the `.` in that command with the path to the subdirectory. And if you are working on react-native run `node --inspect ./node_modules/@viewstools/morph/cli.js . --watch --as react-native`
18
195. In chrome open your dev tools on any tab. Click on the green icon at the top to open the node dev tools. Bingo! :tada:
20
216. Everytime you make changes to the code in the morpher you'll need to run `yarn prepare` for those changes to be picked up by your Views project.
22
23## How do I update tests?
24
25The tests are in `__tests__/views`. We are using [Jest snapshot testing](https://facebook.github.io/jest/docs/en/snapshot-testing.html).
26
27You can run all the tests with `yarn test`, or you can run a specific test with `jest -t '<nameOfTest>'`.
28
29You can debug a specific test with `node --inspect node_modules/.bin/jest --runInBand -t='<nameOfTest>'`.
30
31When you're happy with snapshot diffs you can run `yarn test -u` to update them all at once or you can run `jest --updateSnapshot -t='<nameOfTest>'` to update them individually.
32
33All tests should be passing before you open a PR.<br/><br/>
34
35Having problems? Let us know in the [Views slack channel](https://slack.views.tools/).
36
37Thanks! :clap: