Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

"TypeError: Cannot read property 'includes' of undefined" error in jest with typescript

$
0
0

I have used expo-apple-authentication library, which is causing error while creating snapshot with jest.

Error

● Test suite failed to run    TypeError: Cannot read property 'includes' of undefined      at requireNativeViewManager (node_modules/@unimodules/react-native-adapter/src/NativeViewManagerAdapter.native.tsx:28:49)      at Object.<anonymous> (node_modules/expo-apple-authentication/src/ExpoAppleAuthenticationButton.ts:15:46)      at Object.<anonymous> (node_modules/expo-apple-authentication/src/AppleAuthenticationButton.tsx:8:1)

jest.config.js

// jest.config.jsconst { defaults: tsjPreset } = require("ts-jest/presets");const { setupFiles } = require("@testing-library/react-native/jest-preset");module.exports = {   preset: "jest-expo",   globals: {"ts-jest": {         tsconfig: "tsconfig.spec.json",      },   },   transform: {"^.+\\.jsx$": "babel-jest","^.+\\.tsx?$": "ts-jest","node_modules/variables/.+\\.(j|t)sx?$": "ts-jest",   },   transformIgnorePatterns: ["node_modules/(?!((jest-)?react-native|@react-native(-community)?)|expo(nent)?|@expo(nent)?/.*|@expo-google-fonts/.*|react-navigation|@react-navigation/.*|@unimodules/.*|unimodules|sentry-expo|native-base|react-native-svg)",   ],   moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],   modulePathIgnorePatterns: ["./server"],   setupFiles: ["<rootDir>/components/utils/jestSetup.ts", ...setupFiles],};

babel.config.js

module.exports = function (api) {   api.cache(true);   return {      presets: ["babel-preset-expo", "@babel/preset-typescript"],   };};

tsconfig.spec.json

// tsconfig.spec.json{"extends": "./tsconfig.json","compilerOptions": {"jsx": "react"   } }

I am new to jest, it would be great if someone help me with this.


Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>