1

Jest config is:

module.exports = {
  transformIgnorePatterns: ['<rootDir>/node_modules/(?!(@react-native|react-native)/)'],
  preset: 'react-native',
  transform: {
    '^.+\\.js$': require.resolve('react-native/jest/preprocessor.js'),
  },
};

In babel config there is presets: ['module:metro-react-native-babel-preset'],

In package I have

"jest": "^24.9.0",
"react": "^16.14.0",
"react-native": "^0.64.0",

Versions of React and React-native are strict because of youi-tv

If I run jest I get an error:

SyntaxError: Unexpected identifier

node_modules/@react-native/polyfills/error-guard.js:14
type ErrorHandler = (error: mixed, isFatal: boolean) => void;

Also if I use ts-jest with configuration I can get such an error in my *.test.tsx

SyntaxError: Unexpected token '<'

Please any advice

1 Answer 1

1

For me the problem was that I used more than one string in the "transformIgnorePatterns" on the jest configuration in the package.json.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.