TypeError: Cannot read property 'bundleId' of undefined when running Jest tests
See original GitHub issueGeetting the following error when running jest tests:
Error:
TypeError: Cannot read property 'bundleId' of undefined
Code:
import DeviceInfo from 'react-native-device-info'
const bundleId = DeviceInfo.getBundleId()
package.json:
"react": "~15.4.1",
"react-native": "^0.38.1"
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:9
Top Results From Across the Web
Cannot read properties of undefined (reading 'length') JEST ...
I am trying to implement jest tests to my project but I have error while running test. The thing is that I dont...
Read more >cannot read properties of undefined (reading 'html') at new ...
I've setup a monorepo with Node.js and React. Trying to configure jest to run test suites the api Node works fine but I...
Read more >Unit tests - Mattermost Developers
Review our guidelines for unit testing for your Mattermost webapp, including a guide on how to do ... TypeError: Cannot read property 'filter'...
Read more >Jest unit test fails with Error: Uncaught [TypeError: Cannot ...
... Uncaught [TypeError: Cannot read property 'id' of undefined] - React - EJ 2. ... running this simple test with Jest on a...
Read more >Troubleshooting - Jest
Try running Jest with --no-watchman or set the watchman configuration option to false . Also see watchman troubleshooting. Tests are Extremely ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just mock the method you’re using @zhen639 @arunshan
The solution provided by @carloscuesta worked for me.
package.json:
testenv.js: