Using Typescript baseUrl
and Jest moduleDirectories
break React Import
#12922
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Bug report
After upgrading to v9.4 I set a project with Typescript, Jest & React-testing-library.
my
tsconfig.json
my
jest.config.js
my
index.test.tsx
Describe the bug
after using the
wrapper
feature from React Testing Library I got an error message saidTypeError: Cannot read property 'createElement' of undefined
I tried to dig in code and discovered that method is
React.createElement
.If I remove the 'baseUrl' and
moduleDirectories
and importing the page as normal, everything start to works again.To Reproduce
I prepared a repository for this problem.
https://github.com/omarkhatibco/jest-with-typescript
Expected behavior
React Must be defined.
System information
OS: [e.g. macOS]
Version of Next.js: [e.g. 9.4.0]
Version of Node.js: [e.g. 12.11.1]
Additional context
Add any other context about the problem here.
Beta Was this translation helpful? Give feedback.
All reactions