It seems like many individuals are encountering this particular issue. Despite trying various methods, I am still unable to resolve it.
Currently, I am facing the following error in my terminal:
FAIL tests/App.test.tsx ● Test suite failed to run
Jest encountered an unexpected token
Jest failed to parse a file due to non-standard JavaScript syntax or incorrect Jest configuration.
By default, Jest supports Babel for transforming files based on your Babel configuration.
To address this issue, consider:
• Enabling ECMAScript Modules: https://jestjs.io/docs/ecmascript-modules
• Using TypeScript: https://jestjs.io/docs/getting-started#using-typescript
• Customizing transformation settings in your configuration.
• Stubbing out non-JS modules with moduleNameMapper config option.
Refer to Jest documentation for detailed examples and configurations:
https://jestjs.io/docs/configuration
For custom transformations, visit:
https://jestjs.io/docs/code-transformation
Details:
/Users/mmt10901/Desktop/Code/B2B-Shopfront-Mobile/__tests__/App.test.tsx:37
const component = renderer.create(<App_1.NavBody />);
^
SyntaxError: Unexpected token '<'
at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1495:14)
Here is my current Jest configuration:
Insert Jest configuration here...
My Babel Config:
Insert Babel config details here...
tsConfig.json:
Insert tsConfig.json content here...
I am using "react-native": "0.71.7"
I would greatly appreciate any assistance as I have been struggling with this basic setup for the past 2 days.