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

Cannot read property 'child' of undefined on React 16 + enzyme-adapter-react-16 #2562

Open
2 of 13 tasks
dep opened this issue Jul 8, 2022 · 1 comment
Open
2 of 13 tasks

Comments

@dep
Copy link

dep commented Jul 8, 2022

Current behavior

import React from "react";
import { mount } from "enzyme";
import NewTagModal from "./NewTagModal";

describe("New Tag Modal", () => {
  let component;
  function mountComponent() {
    return mount(
      <NewTagModal isOpen={true} />;
    );
  }

  beforeEach(() => {
    component = mountComponent();
  });

  it("has a title", () => {
    expect(component.find("h4").text()).toBe("Create New Tag");
  });
});

Returns:

    TypeError: Cannot read property 'child' of undefined

      72 |
      73 |   function mountComponent() {
    > 74 |     return mount(

      at getFiber (../../../node_modules/enzyme-adapter-react-16/src/detectFiberTags.js:15:35)
      at detectFiberTags (../../../node_modules/enzyme-adapter-react-16/src/detectFiberTags.js:76:15)
      at ReactSixtee^C

Expected behavior

Tests pass

API

  • shallow
  • mount
  • render

Version

library version
enzyme 3.11.0
react 16.4.0
react-dom 16.4.0
react-test-renderer n/a
adapter (below) enzyme-adapter-react-16

Adapter

  • enzyme-adapter-react-16
  • enzyme-adapter-react-16.3
  • enzyme-adapter-react-16.2
  • enzyme-adapter-react-16.1
  • enzyme-adapter-react-15
  • enzyme-adapter-react-15.4
  • enzyme-adapter-react-14
  • enzyme-adapter-react-13
  • enzyme-adapter-react-helper
  • others ( )
@ljharb
Copy link
Member

ljharb commented Jul 8, 2022

Can you try React v16.4.2?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants