Enzyme `mount` cause error when renders react-select
See original GitHub issueHello!
I have problem with testing latest (3.0.5) version of react-select
code
...
import Select from 'react-select'
const Product = () => (
<Select options={[]} onChange={() => null} />
);
export default connect(() => {}, () => {})(Product);
test suite
import { mount } from 'enzyme';
...
const wrapper = mount(
<IntlProvider locale="en" messages={{}}>
<Provider store={store}>
<Product />
</Provider>
</IntlProvider>
);
...
When enzyme try to mount component with Select
, console displays
TypeError: Cannot read property 'registered' of null
It’s just FYI. In react-select v2.4.4 all is ok.
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (1 by maintainers)
Top Results From Across the Web
Testing React Select component - Stack Overflow
Test 1 : should render without errors. I render the component. I search for the placeholder to be present. Test 2 : should...
Read more >Testing with Jest and Enzyme in React — Part 4 (shallow vs ...
The reason for this is, mount renders the full DOM including the child components in the parent component. So, this has fully rendered...
Read more >Continuous integration for React applications using Jest and ...
Learn how to implement continuous integration for React applications using Jest and Enzyme.
Read more >Testing a Custom Select with React Testing Library
One of the questions that come up more often is how to test a custom select component. By custom select I mean a...
Read more >[Solved]-Testing React Select component-Reactjs
[Solved]-Testing React Select component-Reactjs · Test 1 : should render without errors · Test 2 : should call onChange when the first option...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Based on the error, it seems we need to make sure a
CacheProvider
is available:That got all of my tests running without needing to downgrade my react-select version, however, may not be the best solution.
I did need to add
emotion
as a dependency,yarn add emotion
Same issue here. Someone???
I have 3.0.8 version and the problem still happen.