Varsha Vinod
Varsha Vinod

Reputation: 289

TypeError: Cannot destructure property 'config' of 'cacheKeyOptions' as it is undefined

As part of nodejs 18 upgrade, the following versions were upgraded.

"react": "17.0.2",
"react-dom": "17.0.2"
"jest": "29.7.0",
"jest-cli": "29.7.0",
"jest-environment-jsdom": "29.7.0",
"@babel/preset-env": "7.0.0",
"@babel/preset-react": "7.0.0",
"@babel/preset-stage-2": "7.0.0",
"babel-jest": "26.6.3",
"babel-loader": "8.2.2",
"@babel/core": "7.0.0",

In the babel config file, presets also were updated:

presets: ['@babel/react', '@babel/preset-stage-2', '@babel/env'],

After running npm run test, I am getting the following error:

Test suite failed to run

TypeError: Cannot destructure property 'config' of 'cacheKeyOptions' as it is undefined.

  at Object.getCacheKey (node_modules/babel-jest/build/index.js:217:14)

Other forums mentioned to use the babel-jest version 26.6.3 but it doesn't help.

Upvotes: 2

Views: 859

Answers (1)

Alex C
Alex C

Reputation: 11

There is a mismatch between jest 29.7.0 and babel-jest 26.6.3

I had the same issue. It got resolved once I upgraded babel-jest to 29.7.0 as well.

Upvotes: 1

Related Questions