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.)
Top comments (0)