Skip to content
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

TypeError: Cannot destructure property 'config' of 'options' as it is undefined. #743

Closed
pouyarahmti opened this issue May 30, 2021 · 7 comments
Labels
question Further information is requested

Comments

@pouyarahmti
Copy link

Ask your Question

Hi, I have installed React Native Testing Library and i wanted to test React Navigation as the docs has explained. But i got an error which says TypeError: Cannot destructure property 'config' of 'options' as it is undefined. I wonder if you could help me fix it.

ReactNative: 0.64.1
Jest: 27.0.3
ReactNativeTesting Library: 7.2.0

@pouyarahmti pouyarahmti added the question Further information is requested label May 30, 2021
@b3coded
Copy link

b3coded commented May 30, 2021

@pouyarahmti React Native is using @jest/create-cache-key-function 26.5.0 that is incompatible with jest 27

I'm using jest 27 with yarn resolutions on my package.json

"resolutions": {
    "react-native/@jest/create-cache-key-function": "^27.0.2"
 }

if it does not work for you, maybe you should downgrade to jest 26 for now

@pouyarahmti
Copy link
Author

It didn't work with resolutions but with downgrading to jest 26 everything was running okay. Thanks for your help

@thymikee
Copy link
Member

See: facebook/react-native#30637. Closing. As a workaround, you can use Yarn's resolutions field and pin "@jest/create-cache-key-function": "^27.0.1"

@hrdyjan1
Copy link

hrdyjan1 commented Oct 25, 2021

The solution from @b3coded worked for me, but the necessary step was to remove/add (update) jest package in the project.

@charlestbell
Copy link

@pouyarahmti 's solution worked for me. Had to go to version 26. Basically this means that jest's node --inspect-brk ./node_modules/jest/bin/jest.js --runInBand commadn doesn't work on anything newer than 26. They really should improve their documentation.

hyochan added a commit to dooboolab-community/hackatalk that referenced this issue Dec 19, 2021
hyochan added a commit to dooboolab-community/hackatalk that referenced this issue Dec 25, 2021
hyochan added a commit to dooboolab-community/hackatalk that referenced this issue Dec 25, 2021
* Upgrade expo sdk 44

* Update webpack config

* Fix cannot destructure config err
   Refer callstack/react-native-testing-library#743

* Downgrade svgr to 5
   This is only compatible with webpack 5 but expo-cli is still using 4.

* Fix tests downgrading `jest-expo` to 43

* Tested with jest-expo 44.0.0
CodingItWrong added a commit to CodingItWrong/surely-expo that referenced this issue Feb 5, 2022
Fixes warning when running tests "TypeError: Cannot destructure property 'config' of 'options' as it is undefined"

See callstack/react-native-testing-library#743
@SrBrahma
Copy link

SrBrahma commented Feb 8, 2022

For expo users, you can just npm remove jest and expo install jest, and it will install the supported version. It's the recommended way as said in https://docs.expo.dev/guides/testing-with-jest/#installation

@bonusrk
Copy link

bonusrk commented Nov 18, 2022

maybe it will help someone in 2022.
i figured it out bumping all libraries connected with jest to the same (as jest) version. for me it was:

{
  "devDependencies" : {
     "jest": "^29.3.1",
     "babel-jest": "^29.3.1",
      // should not raise error in runtime but fresh types are fresh
     "@types/jest": "^29.2.3",
     "ts-jest": "^29.0.3",
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

7 participants