TypeError: Cannot read property 'fetch' of undefined
at node_modules/whatwg-fetch/fetch.js:4:8 at Object.<anonymous> (node_modules/whatwg-fetch/fetch.js:466:3) at Object.<anonymous> (node_modules/jest-expo/src/setup.js:97:348)
Got error while running tests with jest-expo. If anyone have solution please share.
Obviously this is a guess without a code snippet, but looking at what fetch.js
looked like at the time, the undefined
value whose fetch
property we can't read is the variable self
(see line 1), which was meant to be set to the this
context (see line 466).
Therefore, it seems that fetch.js
is expecting to run in an environment where this
refers to the window
, but jest-expo
, being a testing tool, is running it in some other environment, probably in strict mode where this
is undefined
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With