React native 使用Jest运行测试时,无法忽略节点_模块中的包

React native 使用Jest运行测试时,无法忽略节点_模块中的包,react-native,jestjs,React Native,Jestjs,我在设置jest并运行测试时遇到了这个问题,尽管配置了jest TypeError: Cannot read property 'Constants' of undefined at Object.<anonymous> (node_modules/@momo-platform/component-kits/components/qrcodeScanner/QRCodeScannerView.js:1:2882) at Object.<anon

我在设置jest并运行测试时遇到了这个问题,尽管配置了jest

    TypeError: Cannot read property 'Constants' of undefined

      at Object.<anonymous> (node_modules/@momo-platform/component-kits/components/qrcodeScanner/QRCodeScannerView.js:1:2882)
      at Object.<anonymous> (node_modules/@momo-platform/component-kits/index.js:1:22069)

  console.error node_modules/prop-types/factoryWithTypeCheckers.js:23
    Warning: Invalid arguments supplied to oneOf, expected an array, got 3 arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).

大家能帮我忽略node_模块/@MoMoMo平台/node_模块中组件套件的问题吗?

transformIgnorePatterns就是忽略转换,顾名思义。如果出现语法错误,它将适用。模拟所有特定于本机的内容,因为它在节点中不可用。因此,如果我想忽略@MoMoMo平台/组件工具包中运行的Jest,我该怎么做?此错误是Js非本机代码类型错误:无法读取未定义的属性“常量”包特定于反应本机,不是吗?您可以确定它会失败,因为它是设计在设备上而不是节点上运行的。至于忽略,请参见
module.exports = {
    preset: 'react-native',
    moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
    cacheDirectory: './cache',
    // "coveragePathIgnorePatterns": [
    //   "./app/utils/vendor"
    // ],
    coverageThreshold: {
        global: {
            statements: 80,
        },
    },
    moduleNameMapper: {
        '.+\\.(png|jpg|ttf|woff|woff2)$': 'jest-transform-stub',
    },
    transformIgnorePatterns: [
        'node_modules\/(?!(react-native|react-native-camera-kit|react-native-linear-gradient|react-native-iphone-x-helper|react-native-progress|@react-native-community|@momo-platform/component-kits/components/qrcodeScanner/QRCodeScannerView.js))(.*)',
    ],
};