DEV Community

Juha Autero
Juha Autero

Posted on

1 1

PizzaTimer: Starting the project

I wanted to learn to write mobile applications and decided to look into React Native. I also think that I eat pizza too often and decided to write an app that tells me how long it has been since I ate pizza. Or rather, when I can eat pizza again. (I'm thinking of trying to limit it once a week.)

Getting first React native project created was easy following the instructions, but then I run into a snag. I like TDD and wanted to setup
mocha for unit tests. Unfortunately there has been recent changes in both mocha and babel. None of the instructions seemed to work. Finally, I decided that I don't know enough modern JS development with ES2015 style imports and transpilers and gave up. I was going to look into Flutter next but never got around to it.

That is the problem with instructions that just explain what you should do without telling why. If things don't work you have no idea what you did wrong or how to start debugging your configuration.

Yesterday I looked at my code again and found the babel link above. I replaced 'babel-preset-es2015' with 'babel-preset-env' and run mocha with '--require @babel/register' and things worked!

Code is available at GitHub. (I would use Liquid tag, but it doesn't support repositories that don't have ReadMe.)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more