-
Notifications
You must be signed in to change notification settings - Fork 450
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 encountered an unexpected token #4267
Comments
I have a similar issue. It seems to me that for some reason ts-jest instructs the typescript compiler to emit ES3/ES5 code. I cannot pinpoint where this is happening though |
This error indicates that Jest tried to process Usually, this can be solved by configuring You can also use Jest ESM mode to process ESM axios file. |
Detail:
I have updated a third party library axios version to 1.6.7 . When I ran tests I started to get the following error
` Jest encountered an unexpected token
package.json
jest.config.js
`const { jest: lernaAliases } = require('lerna-alias');
module.exports = {
preset: 'ts-jest',
moduleNameMapper: lernaAliases(),
transform: {
'^.+\.tsx?$': 'ts-jest', // Add TypeScript transformation
'^.+\.jsx?$': 'babel-jest', // Add Babel transformation for ES6 modules
},
coverageReporters: [['lcov', { projectRoot: '../../' }]]
};
`
The text was updated successfully, but these errors were encountered: