githuboftigran / rn-range-slider

A native slider with range
MIT License
237 stars 133 forks source link

Jest test problem #36

Closed fajarmf10 closed 4 years ago

fajarmf10 commented 4 years ago

How do you test this module on jest? It always throw me an error like this:

/node_modules/rn-range-slider/index.js:1 ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import React, {PureComponent} from 'react'; SyntaxError: Unexpected identifier

it points to the import React. the same happens on FontAwesome, but I could mock the FontAwesome using this

stargamerboy786 commented 1 year ago

How do you solve this issue ??

ZvarychStepan commented 1 year ago

@stargamerboy786 just add it to transformIgnorePatterns before:

"transformIgnorePatterns": [
      "node_modules/(?!(jest-)?@?react-native|@react-native-community|@react-navigation|victory|victory-native)"
    ],

after:

"transformIgnorePatterns": [
      "node_modules/(?!(jest-)?@?react-native|@react-native-community|@react-navigation|victory|victory-native|rn-range-slider)"
    ],