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
git clone https://github.com/jellydn/react-tips-2022-demo
cd react-tips-2022-demo
git checkout 973357373b2ea6fdc629e4b11872eb99951daed9
yarn
yarn jest-preview
yarn test
Expected behavior
Should see the image
Additional context
When inspecting the cache of Jest Code Transformation for SVG using ts-jest, it looks like this
If I switch to @swc/jest, it looks like this:
The difference is that @swc/jest use _interopRequireDefault to import the file in both CommonJS and ES Modules cases. So this is likely the issue comes from ts-jest. (But it's ok since before jest preview, we do not care about SVG files in Jest)
Possible solutions
Open an issue/ Send a PR to ts-jest to include _interopRequireDefault (or similar)
Switch to other code transformers such as @swc/jest.
1 should be the correct fix. However, users can workaround using 2 when 1 is not ready yet.
The text was updated successfully, but these errors were encountered:
Describe the bug
Cannot see images if we use
ts-jest
to process.tsx
filesDemo video: https://youtu.be/rkgSxUaFfnY?t=502
To Reproduce
Expected behavior
Should see the image
Additional context
When inspecting the cache of Jest Code Transformation for SVG using
ts-jest
, it looks like thisIf I switch to
@swc/jest
, it looks like this:The difference is that
@swc/jest
use_interopRequireDefault
to import the file in both CommonJS and ES Modules cases. So this is likely the issue comes fromts-jest
. (But it's ok since before jest preview, we do not care about SVG files in Jest)Possible solutions
ts-jest
to include_interopRequireDefault
(or similar)@swc/jest
.1
should be the correct fix. However, users can workaround using2
when1
is not ready yet.The text was updated successfully, but these errors were encountered: