Skip to content

TypeError: Cannot read property 'Tag' of undefined #108

Answered by magnuslinden
dribeirodev asked this question in Q&A
Discussion options

You must be logged in to vote

I'm seeing the same TypeError: Cannot read properties of undefined (reading 'Tag') error in my tests, running:

{
  "@chakra-ui/react": "^1.7.2",
  "react-select": "^4.3.1",
  "chakra-react-select": "^1.3.4",
  "@emotion/react": "^11.7.0",
}

and testing with jest + react testing library.

EDIT:

To fix this I simply had to wrap my tests with <ChakraProvider>[...]</ChakraProvider>. Figured that out by looking at Chakra's own testing utilities found here: https://github.com/chakra-ui/chakra-ui/blob/main/tooling/test-utils/src/test-utils.tsx

I've got a bunch of tests that run fine without being wrapped in <ChakraProvider>, which threw me off when tests that had this package included failed, but…

Replies: 8 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by csandman
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants
Converted from issue

This discussion was converted from issue #19 on May 05, 2022 19:33.