Cannot read property 'child' of undefined on React 16 + enzyme-adapter-react-16
dep opened this issue · 1 comments
dep commented
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 commented
Can you try React v16.4.2?