Describe the bug
After upgrading to React v16.5.0, all mount fails with error information: "Invariant Violation: Unable to find node on an unmounted component."
To Reproduce
Steps to reproduce the behavior:
import React from 'react';
import PropTypes from 'prop-types';
import Enzyme from 'enzyme';
const {mount, shallow} = Enzyme;
const Adapter = require('enzyme-adapter-react-16');
Enzyme.configure({adapter: new Adapter()});
describe('test name', () => {
it('foo', () => {
const wrapper = mount(<div>hello</div>);
expect(wrapper.html()).toMatch(/hello/);
});
});
Expected behavior
It should pass, but failed.
After lock React version in 16.4.0, the same unit test passes.
Desktop (please complete the following information):
What version of react-dom are you using? The versions of react and react-dom always must be identical. (or at least the same minor)
What enzyme-adapter-react-16 package version do you use? Upgrading it to version 1.5.0 helped me.
That is also required, as v1.5.0 contains a bugfix that prevents React v16.5 from breaking.
I was also having this error, but upgrading to [email protected] fixed it for me so maybe that is all it takes?
@tyler-johnson After upgrading to h3o-next-example/package.json, it works. Thank you
Most helpful comment
That is also required, as v1.5.0 contains a bugfix that prevents React v16.5 from breaking.