Tcomb-form-native: Jest test `Unexpected token import`

Created on 12 Jan 2018  路  2Comments  路  Source: gcanti/tcomb-form-native

Version

  • tcomb-form-native v0.6.11
  • react-native v0.51

Expected behaviour

Test should run by loading the component.

Actual behaviour

node_modules/tcomb-form-native/index.js:1
    ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import t from "./lib";
                                                                                             ^^^^^^

    SyntaxError: Unexpected token import

      at ScriptTransformer._transformAndBuildScript (node_modules/jest-runtime/build/script_transformer.js:305:17)
      at Object.<anonymous> (app/scenes/Login/index.js:15:22)
      at Object.<anonymous> (app/scenes/Login/index.test.js:3:12)

The line that is causing my test to fail: import tcomb from "tcomb-form-native"

Most helpful comment

Please add this to your Jest config in the package.json file:

    "transformIgnorePatterns": [
      "node_modules/(?!react-native|tcomb-form-native)"
    ]

All 2 comments

+1

Please add this to your Jest config in the package.json file:

    "transformIgnorePatterns": [
      "node_modules/(?!react-native|tcomb-form-native)"
    ]
Was this page helpful?
0 / 5 - 0 ratings

Related issues

albertogugliotta picture albertogugliotta  路  3Comments

sibelius picture sibelius  路  4Comments

michaelbenker picture michaelbenker  路  3Comments

abdelghafourzguindou picture abdelghafourzguindou  路  4Comments

flyingace picture flyingace  路  5Comments