Post/Code

HomeAboutUsesNow

Expo and Jest.

A few thoughts on Expo and Jest:

Expo.

When using Expo with React Native applications, I have found it best to use the LAN option when developing - it is far quicker in my experience than Tunnel. Your device and the machine you are developing need to be on the same network though.

If that is not working for some reason, I find the LAN option, while preferable, to be a bit more flaky than Tunnel. The Tunnel option seems to work most of the time.

I still wish I could use regular browser Dev Tools to inspect layouts though...

Jest.

Jest runs in "watch" mode by default, as such, if you only want to run Jest once, enter the following into the command line:

CI=true npm test

If you want to see your code coverage and only run once, you can do the following:

CI=true npm test -- --coverage

Over the past few days, I have been working on improving my knowledge of testing in React. I find it useful to have the code coverge open while you develop so that you can catch missing branches as they happen. Might not be the preference for most people, but I find it easier to think about possible solutions at the time of writing the code, rather than having to come back later. Granted, that is probably how most of it will shake out, but it's worth keeping in mind since it only takes a slight command change to have it available.