Configuring Jest in React Native 0.57.0

I'm trying to get a baseline React Native app setup. Unfortunately, I kept running into problems with configuring Jest. When I run yarn test, I'd get this failure:

$ yarn test
yarn run v1.6.0  
warning ../../../package.json: No license field  
$ jest
 FAIL  ./App.test.js
  ‚óŹ Test suite failed to run

    Couldn't find preset "module:metro-react-native-babel-preset" relative to directory "/Users/jn/Documents/Apps/BaseRNApp"


I finally found the answer here : https://github.com/facebook/metro/issues/242#issuecomment-421139247

Basically, you add this to the "jest" section of your package.json file.

"transform": { "^.+\\.js$": "<rootDir>/node_modules/react-native/jest/preprocessor.js" }  

So, on a perfectly clean install of react native 0.57.0, the jest section of package.json should look like this:

  "jest": {
    "preset": "react-native",
    "transform": { "^.+\\.js$": "<rootDir>/node_modules/react-native/jest/preprocessor.js" }

Here's a StackOverflow link that also discusses the problem with the solution I'm suggesting: https://stackoverflow.com/a/52367419/75644