-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Cannot read property 'childElementCount' of null" error generated by react-test-renderer #233
Comments
Gidday @rkoziel, thanks for taking the time to file an issue with us. We're not doing anything particularly magical under the hood, so I can't imagine why you might be experiencing this issue. I'll try and take a poke around - but would you please be able to send me a minimal reproducible failing case? Also could you please let me know which versions of |
Hi Mitch, here are the versions of react and react-accessible-accordion
that are used:
react - 16.8.6
react-accessible-accordion - 3.0.0
We are not using react-testing-library. Instead, we are using other
components for testing, including the Jest react-test-renderer v16.8.6. As
noted in the original issue notification, it looks like it is the Jest
react-test-renderer that is having issues with the Accordion.
I'll see what I can put together for a failing case as soon as I am able,
around the other work tasks I have at this time.
Thanks,
Ray Koziel
…On Tue, Aug 20, 2019 at 8:43 AM Mitch Ryan ***@***.***> wrote:
Gidday @rkoziel <https://github.com/rkoziel>, thanks for taking the time
to file an issue with us. We're not doing anything particularly magical
under the hood, so I can't imagine why you might be experiencing this
issue. I'll try and take a poke around - but would you please be able to
send me a minimal reproducible failing case? Also could you please let me
know which versions of react, react-testing-library and
react-accessible-accordion you're using? Thanks!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#233?email_source=notifications&email_token=ALZTEAIZJ7TFV776C47L2PLQFPRIHA5CNFSM4INC4FAKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4WEXOI#issuecomment-522996665>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ALZTEAPPTVRL5PGUJ2XQPT3QFPRIHANCNFSM4INC4FAA>
.
|
Cool thanks for that info @rkoziel. As for the reproducible case - just a copy+paste snippet of a failing test would be really useful, I need to see what kind of context we're dealing with here. Cheers! |
I had the same problem. To fix it in library pls check ref value before check this childElementCount in AccordionItemHeading component. in my case that was solution: jest.mock('react-accessible-accordion') import AccordionWrapper from '..' and test pass. |
Closing pending more specific details |
Struggling with this as well. It's a known issue when testing components with use The workaround is to provide a Node mock:
|
Getting exact same error when attempting to create a snapshot test of the wrapper component. The accordion implementation is similar to the ones taken from your examples - nothing fancy. The test is the following:
|
The error "TypeError: Cannot read property 'childElementCount' of null" is being thrown by react-test-renderer for components that we have implemented the Accordion on, and parent components. This looks like it may be related to how react-test-renderer is rendering the AccordionItemHeading. Are there any recommendations on how to get around this error so we can still use react-test-renderer for our testing?
Thanks,
Ray Koziel
The text was updated successfully, but these errors were encountered: