标签: reactotron

没有连接reactotron/react-native

我尝试在(IOS)React Native 项目中使用 Reactotron 调试应用程序,但当我运行应用程序时,出现“无活动”。

我使用react-native 0.55.4、reactotron 2.1.0(与我的package.json相同)

时间线反应加速器

我的reactotronConfig.js

导入reactotron的index.js文件

我的 package.json 中的 Reactotron

react-native reactotron

4
推荐指数
2
解决办法
1万
查看次数

为 Jest 模拟 Reactotron

我已经用几乎默认的配置设置了 Reactotron:

import Reactotron from 'reactotron-react-native';
import { reactotronRedux } from 'reactotron-redux';

const reactotron = Reactotron
  .configure()
  .useReactNative()
  .use(reactotronRedux())
  .connect();

export default reactotron;
Run Code Online (Sandbox Code Playgroud)

并将其导入到“index.js”中:

if (__DEV__) { import('./app/utils/reactotron'); }
Run Code Online (Sandbox Code Playgroud)

但是在此之后,大多数 Jest 测试都失败了,并出现了下一个错误:

ReferenceError: WebSocket is not defined

   8 |   .useReactNative()
   9 |   .use(reactotronRedux())
> 10 |   .connect();
     | ^
  11 | 
  12 | export default reactotron;

  at createSocket (node_modules/reactotron-react-native/dist/index.js:1:13571)
  at a.value (node_modules/reactotron-core-client/dist/index.js:1:8397)
  at Object.<anonymous> (app/utils/reactotron.js:10:1)
Run Code Online (Sandbox Code Playgroud)

看起来我需要将 WebSocket 或其他东西添加到全局变量中以进行测试,但是我应该为所有测试都这样做,还是有什么办法可以为所有测试设置一次?

jestjs react-native reactotron

3
推荐指数
1
解决办法
1092
查看次数

1
推荐指数
1
解决办法
1003
查看次数