首页 > 解决方案 > 未设置 fbBatchedBridgeConfig

问题描述

yarn test在反应本机移动应用程序上运行时出现错误。

 Test suite failed to run

    Invariant Violation: __fbBatchedBridgeConfig is not set, cannot invoke native modules

      2 | // import console = require('console');
      3 |
    > 4 | if (!NativeModules.DeviceMotionModule) {
        |      ^
      5 |   throw new Error('Native modules for sensors not available. Did react-native link run successfully?')
      6 | }
      7 |

      at invariant (node_modules/invariant/invariant.js:40:15)
      at Object.invariant (node_modules/react-native/Libraries/BatchedBridge/NativeModules.js:162:3)
      at Object.require [as NativeModules] (node_modules/react-native/Libraries/react-native/react-native-implementation.js:322:12)
      at Object.NativeModules (src/NativeModules/SensorsIOS/sensors.js:4:6)

我是开玩笑测试的新手。

我的项目中有一组适用于 IOS 和 Android 的 costum 原生模块(不是 npm 模块)。

标签: react-nativejestjs

解决方案


推荐阅读