Closed memon07 closed 1 month ago
Error "Warning: React.createElement: type is invalid -- expected a string (for built-in
components) or a class/function (for composite components) but got: undefined." usuallymeans that you mocked some module, yet missed to mock one (or more) components exported from that module (hence is undefined
).
It's hard to tell the exact culprit since you have a large amount of mocks. I recommend to disable them gradually (or disable all and enable them gradually) to narrow down which one is causing the issue.
I have been facing two issues mainly
and sometimes i get this too
It seems possibly that
render
andexpect
from testing library are not properly set. i have tried a couple of fixes but noting seems to work.can you please help me find the issue in my setup.
jest.setup.js
jest.config.js
babel.config.js
Example component
i have tried importing expect but still the issue been found .
Package.json