Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

forwardRef error in jest test#326

Unanswered
sandemchad asked this question inQ&A
Jul 9, 2024· 1 comments· 1 reply
Discussion options

I am currently running into an issue where I am encountering the following error in jest tests:

Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
Check the render method ofForwardRef.

When i downgrade to v3 of chakra-react-select everything passes but all ^4 versions appear to have this issue for me.

Im using Chakra-ui 2.7.1 at the moment

Have tried upgrading various packages but does not seem to be having an impact wanted to see if anyone else had any other ideas?

You must be logged in to vote

Replies: 1 comment 1 reply

Comment options

Can you give me a code sample of exactly what you're trying to do?

You must be logged in to vote
1 reply
@sandemchad
Comment options

The jest test fails when rendering theSelect component with or without any props ie:

The a stripped down example of the test that fails looks like this:

importReactfrom'react'import{render}from'@testing-library/react'import{ChakraProvider,Text}from'@chakra-ui/react'import{Select}from'chakra-react-select'test('it can render the select component',()=>{render(<ChakraProvider><Select/></ChakraProvider>)})test('it can render without the select component',()=>{render(<ChakraProvider><Text>This one renders fine</Text></ChakraProvider>)})

The test with the Select raises the error the one without doesn't

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
2 participants
@sandemchad@csandman

[8]ページ先頭

©2009-2025 Movatter.jp