Vya*_*ddy 10 javascript reactjs jestjs react-native expo
TypeError:无法读取undefined的属性'fetch'
Run Code Online (Sandbox Code Playgroud)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)
使用jest-expo运行测试时出错.如果有人有解决方案请分享.
小智 1
显然,这是没有代码片段的猜测,但看看当时的样子fetch.js
,我们无法读取undefined
其属性的值是变量(请参见第 1 行),该变量本应设置为上下文(请参见第 1 行) 466)。fetch
self
this
因此,似乎期望在指的是 的fetch.js
环境中运行,但是,作为测试工具,正在其他一些环境中运行它,可能是在严格模式下,其中是。this
window
jest-expo
this
undefined
归档时间: |
|
查看次数: |
336 次 |
最近记录: |