You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using Jest with typescript 4.x and React 17 (Create React App 4).
The babel-jest transformer always throws error importSource cannot be set when runtime is classic
Because I'm using emotion css in my jsx, so I have to append the @jsxImportSource in the .tsx file, like:
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.
Describe the bug
I'm using Jest with typescript 4.x and React 17 (Create React App 4).
The babel-jest transformer always throws error
importSource cannot be set when runtime is classic
Because I'm using emotion css in my jsx, so I have to append the @jsxImportSource in the .tsx file, like:
I've tried overwrite the babel config like
it still doesn't work.
Did you try recovering your dependencies?
Yes
Which terms did you search for in User Guide?
jestjs/jest#11394
Environment
Environment Info:
current version of create-react-app: 4.0.3
running from C:\Users\yuex\AppData\Roaming\npm-cache_npx\13392\node_modules\create-react-app
System:
OS: Windows 10 10.0.19043
CPU: (8) x64 Intel(R) Core(TM) i7-9700 CPU @ 3.00GHz
Binaries:
Node: 14.16.1 - C:\Program Files\nodejs\node.EXE
Yarn: Not Found
npm: 6.14.12 - C:\Program Files\nodejs\npm.CMD
Browsers:
Chrome: Not Found
Edge: Spartan (44.19041.964.0), Chromium (90.0.818.62)
Internet Explorer: 11.0.19041.1
npmPackages:
react: 17.0.2
react-dom: 17.0.2
react-scripts: 4.0.3 => 4.0.3
npmGlobalPackages:
create-react-app: Not Found
Steps to reproduce
/** @jsxImportSource @emotion/core */
in the App.tsx fileThen run
npm run test
Expected behavior
Expect no error here.
Actual behavior
display below errors:
importSource cannot be set when runtime is classic
Reproducible demo
(Paste the link to an example project and exact instructions to reproduce the issue.)
The text was updated successfully, but these errors were encountered: