Thanks for reporting an issue to us! We're glad you are using and invested in Enzyme.
Before submitting, please read over our commonly reported issues to prevent duplicates!
Run all my tests, with every test leveraging mount() failing with the following error:
TypeError: (0 , _enzymeAdapterUtils.getNodeFromRootFinder) is not a function
Run all my tests without error.
https://github.com/OperationCode/front-end
MacOS latest
| library | version
| ------------------- | -------
| enzyme | 3.9.0
| react | 16.8.6
| react-dom | 16.8.6
| react-test-renderer | 16.8.6
| adapter (below) |
Just wanted to report the same error.
Minimal example
Component:
import * as React from 'react';
interface TestComponentProps {
}
export class TestComponent extends React.Component<TestComponentProps> {
render() {
return (
<div className='TestComponent'>
Test
</div>
);
}
}
Tests:
import * as React from 'react';
import { configure, mount, shallow } from 'enzyme';
import * as ReactSixteenAdapter from 'enzyme-adapter-react-16';
import {TestComponent} from './TestComponent';
configure({ adapter: new ReactSixteenAdapter() });
describe('TestComponent', () => {
// Working on both 1.11.2 and 1.12.0
it('should contain a div with the correct class (shallow)', () => {
const testComponent = shallow(<TestComponent />);
expect(testComponent.find('.TestComponent')).toHaveLength(1);
}
);
// Failing on 1.12.0. Working on 1.11.2
it('should contain a div with the correct class (mount)', () => {
const testComponent = mount(<TestComponent />);
expect(testComponent.find('.TestComponent')).toHaveLength(1);
});
});
Thanks, looks like I need to publish a patch that bumps the minimum version of adapter-utils. Coming shortly.
Specifically, you can fix this by ensuring enzyme-adapter-utils is fully updated - if you have a lockfile, that might be causing the problem - but by publishing a patch, it'll force it to be updated.
v1.12.1 of the adapter is published. Happy to reopen if that doesn't solve it.
Thanks for the fix. Works for me! 馃憤
Absurdly fast. Thanks @ljharb
Most helpful comment
v1.12.1 of the adapter is published. Happy to reopen if that doesn't solve it.