Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jest gets confused by Shoutem #151

Closed
markspolakovs opened this issue Feb 5, 2017 · 2 comments
Closed

Jest gets confused by Shoutem #151

markspolakovs opened this issue Feb 5, 2017 · 2 comments

Comments

@markspolakovs
Copy link

The Jest test runner seems to get confused by Shoutem.

Steps to reproduce:

  1. react-native init jestShoutem
  2. yarn add @shoutem/ui
  3. (in index.android.js) add import { Text } from '@shoutem/ui';
  4. jest

Jest gives the output

 FAIL  __tests__\index.android.js
  ● Test suite failed to run

    D:\Code\shoutemJest\node_modules\@shoutem\ui\index.js:1
    ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import { setDefaultThemeStyle } from './init';
                                                                                             ^^^^^^
    SyntaxError: Unexpected token import

      at transformAndBuildScript (node_modules\jest-runtime\build\transform.js:320:12)
      at Object.<anonymous> (index.android.js:13:9)
      at Object.<anonymous> (__tests__\index.android.js:3:19)

Using Jest version 18.1.0, React Native version 0.41.0, node version 7.5.0, yarn version 0.19.1, @shoutem/ui version 0.10.8

@vitalyrotari
Copy link

vitalyrotari commented Feb 6, 2017

@markspolakovs in package.json

{
  // ...
  "jest": {
    // ...
    "transformIgnorePatterns": [
      "node_modules/(?!react-native|@shoutem/theme|@shoutem/animation|@shoutem/ui)"
    ]
  }
  // ...
}

mleu added a commit to IMSmobile/rn-prototype that referenced this issue Mar 15, 2017
@zrumenjak
Copy link
Contributor

This is due to a problem with the jest configuration. It looks like the official recommendation is to use the transformIgnorePatters described above (jestjs/jest#2081), so I am closing this for now. Please let us know if anyone finds a better solution for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants