jeudi 4 avril 2019

How can I fix my test suites failure to run because of the tcomb-form-native library for React Native?

I am trying to perform unit testing and integration testing for a React Native application. When running yarn test --coverage several of my test suites fail to run because of the tcomb-form-native library.

I receive this specific error:

({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import t from "./lib";

SyntaxError: Unexpected identifier

  13 | // import { gray } from 'ansi-colors';
  14 |
> 15 | import t from 'tcomb-form-native';
     | ^
  16 |
  17 | const Form = t.form.Form;
  18 |

  at ScriptTransformer._transformAndBuildScript (node_modules/jest-runtime/build/script_transformer.js:403:17)
  at Object.<anonymous> (screens/ReservationScreen.js:15:1)

I updated the package.json file following the Tests section from the library's GitHub, https://github.com/gcanti/tcomb-form-native, but continue to get the same error.

I'm confused by this line from the tcomb-form-native ReadMe Tests description:

  "ios.js"    <<<<<<<<<<<< this needs to be defined!

I created the React Native app using Expo so I don't have an ios.js file. The only difference under the "jest": from the example code in the GitHub is that I also have "preset": "jest-expo", defined.

What changes do I need to make to my package.json file or my test suites in order for my test suites to run? (They don't have to pass, just simply run.)

Aucun commentaire:

Enregistrer un commentaire