Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TyperError: this._instance.render is not a function #17913

Closed
Praveencena88 opened this issue Jan 27, 2020 · 3 comments
Closed

TyperError: this._instance.render is not a function #17913

Praveencena88 opened this issue Jan 27, 2020 · 3 comments
Assignees
Labels
Resolution: Needs More Information Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug

Comments

@Praveencena88
Copy link

Praveencena88 commented Jan 27, 2020

After updating all the react-native and jest dependencies for app, test is not running its throwing error like this,

Error :

    TypeError: this._instance.render is not a function

      17 |
      18 | it('renders correctly', () => {
    > 19 |   const wrapper = shallow(
         |                   ^
      20 |     <MainApp store={store}/>)
      21 |     //expect(wrapper).toMatchSnapshot();
      22 | });

      at ReactShallowRenderer._mountClassComponent (node_modules/react-test-renderer/cjs/react-test-renderer-shallow.development.js:898:41)
      at ReactShallowRenderer.createElement [as render] (node_modules/react-test-renderer/cjs/react-test-renderer-shallow.development.js:815:18)
      at node_modules/enzyme-adapter-react-16/src/ReactSixteenAdapter.js:780:18
      at withSetStateAllowed (node_modules/enzyme-adapter-utils/build/Utils.js:200:16)
      at Object.render (node_modules/enzyme-adapter-react-16/build/ReactSixteenAdapter.js:968:68)
      at new ShallowWrapper (node_modules/enzyme/src/ShallowWrapper.js:488:5)
      at shallow (node_modules/enzyme/build/shallow.js:26:10)
      at Object.<anonymous> (__tests__/App.js:19:19)

Package.json :

{
  "dependencies": {
    "@react-native-community/async-storage": "^1.6.2",
    "@react-native-community/cameraroll": "^1.2.1",
    "@react-native-community/checkbox": "^0.2.0",
    "@react-native-community/datetimepicker": "^2.1.0",
    "@react-native-community/geolocation": "^2.0.2",
    "@react-native-community/netinfo": "^4.4.0",
    "@redux-offline/redux-offline": "^2.5.2-native.1",
    "axios": "^0.18.1",
    "babel-core": "^6.26.3",
    "babel-plugin-transform-remove-console": "^6.9.4",
    "draft-js": "^0.11.1",
    "immutable": "^4.0.0-rc.12",
    "js-search": "^1.4.3",
    "lodash": "^4.17.15",
    "lottie-ios": "^3.0.3",
    "lottie-react-native": "^3.0.3",
    "react": "^16.9.0",
    "react-dom": "^16.9.0",
    "react-native": "^0.61.4",
    "react-native-calendars": "^1.212.0",
    "react-native-camera": "^3.7.1",
    "react-native-draftjs-render": "^2.9.0",
    "react-native-firebase": "^5.5.6",
    "react-native-gesture-handler": "^1.4.1",
    "react-native-image-resizer": "^1.0.1",
    "react-native-interactable": "^1.0.0",
    "react-native-linear-gradient": "^2.5.6",
    "react-native-maps": "^0.25.0",
    "react-native-reanimated": "^1.3.0",
    "react-native-sound": "^0.10.12",
    "react-native-svg": "^9.11.1",
    "react-native-vector-icons": "^6.6.0",
    "react-native-video": "^4.4.4",
    "react-native-webview": "^7.4.2",
    "react-navigation": "^4.0.10",
    "react-navigation-stack": "^1.9.4",
    "react-navigation-tabs": "^2.5.6",
    "react-redux": "^7.1.1",
    "redux": "^4.0.5",
    "redux-persist": "^6.0.0",
    "redux-persist-filesystem-storage": "^2.0.0",
    "redux-persist-transform-immutable": "^5.0.0",
    "redux-thunk": "^2.3.0",
    "rn-fetch-blob": "^0.11.2",
    "sound": "^2.6.1",
    "url": "^0.11.0",
    "victory-native": "^32.0.2"
  },
  "devDependencies": {
    "@babel/core": "^7.6.2",
    "@babel/preset-env": "^7.8.3",
    "@babel/runtime": "^7.6.2",
    "@react-native-community/eslint-config": "^0.0.5",
    "@welldone-software/why-did-you-render": "^3.3.7",
    "appcenter": "^2.3.0",
    "appcenter-analytics": "^2.3.0",
    "appcenter-crashes": "^2.3.0",
    "babel-jest": "^24.9.0",
    "babel-plugin-rewire": "^1.2.0",
    "babel-preset-react-native": "^5.0.2",
    "chai": "^4.2.0",
    "chai-immutable": "^1.6.0",
    "enzyme": "^3.10.0",
    "enzyme-adapter-react-16": "^1.15.0",
    "eslint": "^6.5.1",
    "jest": "^24.7.1",
    "jest-html-reporter": "^2.6.2",
    "jest-react-native": "^18.0.0",
    "jetifier": "^1.6.4",
    "jsdoc": "^3.6.3",
    "metro-react-native-babel-preset": "^0.58.0",
    "path": "^0.12.7",
    "react-addons-test-utils": "^15.6.2",
    "react-native-startup-time": "^1.2.1",
    "react-test-renderer": "^16.9.0",
    "reactotron-react-native": "^4.0.2",
    "redux-devtools-extension": "^2.13.8",
    "redux-logger": "^3.0.6",
    "redux-mock-store": "^1.5.3",
    "redux-test-utils": "^0.3.0",
    "redux-testkit": "^1.0.6",
    "redux-thunk": "^2.3.0",
    "rewire": "^4.0.1"
  },
  "jest": {
    "preset": "react-native",
    "coveragePathIgnorePatterns": [
      "allMocks.js"
    ],
    "setupFiles": [
      "<rootDir>/jest/allMocks.js"
    ],
    "testPathIgnorePatterns": [
      "/*/*.testdata.js$",
      "AppTexttest.js"
    ],
    "transformIgnorePatterns": [
      "/node_modules/(?!(react-native|redux-persist|react-navigation.*?\\.js$))",
      "<rootDir>/app/components/AppText/AppText.js"
    ],
    "transform": {
      "\\.(jpg|jpeg|PNG|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "./fileTransformer.js"
    },
    "reporters": [
      "default",
      [
        "./node_modules/jest-html-reporter",
        {
          "pageTitle": "Unit Test Report",
          "includeFailureMsg": true
        }
      ]
    ]
  }
}

babel.config.js :

module.exports = {
   presets : ['module:metro-react-native-babel-preset',"react-native"]
}
@Praveencena88 Praveencena88 added the Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug label Jan 27, 2020
@bvaughn
Copy link
Contributor

bvaughn commented Jan 27, 2020

It doesn't look like this bug report has enough info for one of us to reproduce it. Bugs without repro info may be closed.

Please provide either a link to a repository on GitHub or a minimal code example that reproduces the problem. Screenshots or videos can also be helpful if they help provide context on how to repro the bug.

Here are some tips for providing a minimal example: https://stackoverflow.com/help/mcve

@satya164
Copy link

Seems you're using enzyme. Isn't this related to enzyme and not React?

@bvaughn
Copy link
Contributor

bvaughn commented Jan 27, 2020

I'm closing this issue for now. It looks like it's also been reported in Enzyme's repo:
enzymejs/enzyme#2319

One of the Enzyme maintainers gave good advice on that issue (to revert the upgrade and try upgrading in smaller pieces).

@Praveencena88 If you are confident that the issue is with react (or react-test-renderer) and not e.g. conflicting versions of dependencies you have installed, then please share a full repro case with us (something one of us can run and look at) and we can re-open the issue!

@bvaughn bvaughn closed this as completed Jan 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Needs More Information Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug
Projects
None yet
Development

No branches or pull requests

3 participants