react-everywhere / re-start

react-native template to target multiple platforms :globe_with_meridians: :iphone: :computer: with single codebase.
https://medium.com/@amoghbanta/write-once-use-everywhere-with-react-native-d6e575efe58e#.nfl50gwfg
MIT License
1.3k stars 85 forks source link

Jest encountered an unexpected token #70

Closed thorakmedichi closed 5 years ago

thorakmedichi commented 5 years ago

Step 2: Describe your environment

Step 3: Describe the problem (try to include screenshots):

running yarn test and getting

` Jest encountered an unexpected token

Details:

/home/thorakmedichi/Development/Projects/stormfree/day-tracer/node_modules/react-native-elements/src/index.js:9
import Button from './buttons/Button';
^^^^^^

SyntaxError: Unexpected token import

  2 | import PropTypes from 'prop-types';
  3 | import { StyleSheet, FlatList, View, Text, TouchableOpacity } from 'react-native';
> 4 | import { Icon } from 'react-native-elements';

`

After some messing around I see the native tests are fine but the web tests are getting the error.

Steps to reproduce:

Create new app with restart option. Yarn add react-native-elements Import Icon from react-native-elements and render to screen create simple 'react-test-renderer'

Observed Results:

Test fails

thorakmedichi commented 5 years ago

This seemed to fix it. Hopefully removing the transformIgnorePatterns from web.jest.config.js is okay big picture :)

https://github.com/react-native-training/react-native-elements/issues/1227