-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: @react-native/polyfills/error-guard.js
not transpiled in distrobution
#33426
Comments
Is it possible to have an update on this? Our repository suffer with jest and supporting @swc/jest for testing would be really cool. |
It's also preventing our codebase to work properly when using Jest for unit testing. It looks unintentional because there is typescript code in a |
Is there any fix for the issue? I can not run any test. |
I am also encountering this problem.. RN Version 0.65.2 npx react-native info:
jest.config.js:
babel.config.js:
If anyone knows of any work arounds, will gladly give you the stronger of my two kidneys |
not working too 😔 Here's the repo which is just a new RN project.
|
I'm in the process of upgrading from 0.67.4 to 0.70.1 and I'm blocked by this presently. I watch this thread with interest, and, I'll report back anything that gets the tests working again. |
In my case I had to rename all instances of The additional code in So I added this module to strip of the flow annotations in the file. // ...
const plugins = [
"@babel/plugin-transform-flow-strip-types",
// ... In the end my working export default {
preset: "react-native",
globalSetup: "<rootDir>/global-test-setup.js",
setupFilesAfterEnv: ["<rootDir>/test-setup.ts"],
moduleNameMapper: {
".png": "<rootDir>/../../jest/fileMock",
"react-native-url-polyfill/auto": "<rootDor>/../../jest/fileMock",
},
setupFiles: [
"<rootDir>/node_modules/react-native-gesture-handler/jestSetup.js",
"./jest-cucumber-config",
],
transform: {
"^.+\\.(bmp|gif|jpg|jpeg|mp4|png|psd|svg|webp)$": require.resolve(
"react-native/jest/assetFileTransformer.js"
),
},
transformIgnorePatterns: [
"node_modules/(?!((jest-)?react-native|@react-native(-community)?)|expo(nent)?|@expo(nent)?/.*|@expo-google-fonts/.*|react-navigation|@react-navigation/.*|@unimodules/.*|unimodules|sentry-expo|native-base|react-native-svg)"
],
globals: {
"ts-jest": {
isolatedModules: true,
},
},
}; |
@nzcodarnoc tried your solution by converting it for a js based project, unfortunately it did not work. Is there a definite root cause for this error or is this something that can only be resolved through hit and trial? |
Ran into this issue as well when trying to use @swc/jest to get away from some memory issues (jestjs/jest#12205). Unfortunately this issue does not just affect |
☝️ This line alone solved the problem for me. |
Since I just tried that, too: After error-guard.js it's node_modules/react-native/Libraries/vendor/core/ErrorUtils.js, then comes node_modules/react-native/index.js I guess this works fine when using babel thanks to node_modules/metro-react-native-babel-preset/src/configs/main.js including I wonder if it would be an option to ship npm packages without flow types, to remove the need for flow transform in each project and making swc/jest an option. |
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
This issue was closed because it has been stalled for 7 days with no activity. |
Description
In trying to integrate
@swc/jest
into our React Native codebase - it was discovered that one of the files (error-guard
) was not being transpiled correctly. I'm not sure if this is by design or not - but the sibling files do not have types. So my guess is that this is not intended.Version
0.66.1
Output of
npx react-native info
Steps to reproduce
See https://github.com/therynamo/SWCJestRepro#swcjestrepro
Snack, code example, screenshot, or link to a repository
https://github.com/therynamo/SWCJestRepro
The text was updated successfully, but these errors were encountered: