0

I have been attempting to resolve this error i keep receiving when running test. My test is a very simple test case. I have been struggling to run this test for last 48 hours. I came across this on stack overflow but no success enter image description here

Here is my package.json file:

{
  "name": "first_project",
  "version": "1.0.0",
  "main": "index.js",
  "scripts": {
    "start": "expo start --dev-client",
    "android": "expo run:android",
    "ios": "expo run:ios",
    "test": "jest",
    "web": "expo start --web"
  },
  "dependencies": {
    "@react-navigation/native": "^6.0.10",
    "@react-navigation/native-stack": "^6.6.2",
    "expo": "~45.0.0",
    "expo-splash-screen": "~0.15.1",
    "expo-status-bar": "~1.3.0",
    "react": "17.0.2",
    "react-dom": "17.0.2",
    "react-native": "0.68.2",
    "react-native-safe-area-context": "4.2.4",
    "react-native-screens": "~3.11.1",
    "react-native-web": "0.17.7"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@babel/preset-env": "^7.1.6",
    "@testing-library/react-native": "^9.1.0",
    "@types/jest": "^28.1.2",
    "@types/react": "^17.0.47",
    "@types/react-native": "^0.67.8",
    "@types/react-test-renderer": "^17.0.2",
    "jest-expo": "^45.0.1",
    "typescript": "^4.7.3"
  },
  "private": true
}

Also here is the test being run:

import React from 'react';
import CustomButton from "./index";
import { render } from "@testing-library/react-native";

describe("CustomButton", () => {
    it("lll", () => {
        render(
            <CustomButton title=""/>
        );
    });
});

Any assistance would be appreciated in terms of what i'm doing wrong to setup test for react-native.

EI-01
  • 1,075
  • 3
  • 24
  • 42
  • https://stackoverflow.com/questions/72088446/uncaught-typeerror-cannot-read-properties-of-undefined-reading-isbatchinglega – Aman Sadhwani Jun 20 '22 at 05:06
  • @AmanSadhwani yes i saw this thread and followed the suggestion. But still no success. – EI-01 Jun 20 '22 at 05:17

0 Answers0