Test.js
beforeEach(() => {
wrapper = mount(<div />);
});
Terminal output
TypeError: Cannot read property '_reactInternalFiber' of null
11 |
12 | beforeEach(() => {
> 13 | wrapper = mount(<div />);
| ^
14 |
15 | console.log(wrapper.debug());
16 | });
at _reactInternalFiber (node_modules/enzyme-adapter-react-16/src/detectFiberTags.js:15:15)
at getFiber (node_modules/enzyme-adapter-react-16/src/detectFiberTags.js:76:15)
at ReactSixteenAdapter.createMountRenderer (node_modules/enzyme-adapter-react-16/src/ReactSixteenAdapter.js:396:19)
at ReactSixteenAdapter.createMountRenderer [as createRenderer] (node_modules/enzyme-adapter-react-16/src/ReactSixteenAdapter.js:702:51)
at new ReactWrapper (node_modules/enzyme/build/ReactWrapper.js:132:30)
at mount (node_modules/enzyme/build/mount.js:21:10)
at Object.beforeEach (src/components/misc/ScrollToTop/ScrollToTop.test.js:13:15
It should mount and run
macOS 10.14.4 (18E226)
VSCode 1.34.0 (1.34.0)
Used create-react-app to build app
| library | version
| ------------------- | -------
| enzyme | 3.9.0
| react | 16.8.6
| react-dom | 16.8.6
| react-test-renderer | 16.8.6
| adapter (below) | 1.13.1
Just to note, shallow(<div />) works just fine, however I need deeper access in this one test.
Tried on a blank create-react-app and everything worked just fine, but as soon as I copied my components over it broke hard. Not entirely sure what's going on here, I didn't install any of the extra dependencies aside from react-router-dom, just ran the same test.
This seems like the same issue as #2110.
I saw that (only after I created this, sorry). Nothing in there could help me 馃槬
Okay so it turns out I was mocking react-dom in a _really_ bad way. A copy/paste jobber from StackOverflow. I have other problems to solve now, but this was not your libraries fault.
Most helpful comment
Okay so it turns out I was mocking
react-domin a _really_ bad way. A copy/paste jobber from StackOverflow. I have other problems to solve now, but this was not your libraries fault.