-
Notifications
You must be signed in to change notification settings - Fork 279
-
This Project is tested to work with Jest, but it should work with other test runners as well.
https://testing-library.com/docs/react-native-testing-library/intro/
Just wondering if someone has had it working with Vitest?
Beta Was this translation helpful? Give feedback.
All reactions
-
🚀 2
Replies: 3 comments 9 replies
-
Hey, why not. Would you like to contribute example setup? :)
Beta Was this translation helpful? Give feedback.
All reactions
-
We try no to added any code that would force running on Jest, so there are high changes that RNTL will work with it out-of-the-box or with minor tweaks. However this is something we didn't try yet.
Beta Was this translation helpful? Give feedback.
All reactions
-
I've been working with vitest-react-native, react-native(web as well) and testing-library for month or longer. There are millions of limitations, but together we can manage any issues
Beta Was this translation helpful? Give feedback.
All reactions
-
@YuriiLutsykSPRO can you elaborate more on your setup, whether it works faster (people frequently mention vitest as faster than Jest), the limitations. I am open to adding support for Vitest in RNTL if that would be a feasible option for testing.
Beta Was this translation helpful? Give feedback.
All reactions
-
My setup is pretty simple now, i use the same setup as the https://github.com/sheremet-va/vitest-react-native library recomends, First and most important limitations is we can't mock libraries related to react native (as unistyles) in test/setupFiles, i didn't fix it. vitest-react-native isn't very reliable. Currently i'm working on fix for testing-library-react-native or react, because i can't use the functions as getByTestId and getByText with vitest
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
-
I don't have a lot of tests to test properly the speed, but looks like vitest is faster than jest, but it' only my first assumption
Beta Was this translation helpful? Give feedback.
All reactions
-
I have been very impressed with vitest and so I am very interested in trying to use vitest with react-native-testing-library. I am just getting started by doing web searches to see what experience others have had attempting this integration. Your optimism is inspiring, @YuriiLutsykSPRO !
I found this issue regarding ESM/CJS incompatibilities: sheremet-va/vitest-react-native#15
I am very early in my attempt, just researching, haven't even installed anything yet, but if CJS/ESM issues are likely to come up I'd love to hear any tips and tricks. This is something that seems to be solved in the jest+react-native-testing-libary world using package.json configuration
{ ...
"jest": {
...
"transformIgnorePatterns": [ ... ]
}
}
Is there an equivalent needed in the vitest+react-native-testing-library situation?
Beta Was this translation helpful? Give feedback.
All reactions
-
Maybe https://VxRN.dev would help: Using Vite instead of Metro for RN. Maybe @natew has some experience with testing with this setup.
Beta Was this translation helpful? Give feedback.
All reactions
-
Have been trying to use React-Native-Testing-Library + React-Native + Expo + Vitest, and it's an endless pit of issues. Probably will take a week to tackle all the dependency issues, it's a bit of a nightmare. Like playing wack-a-mole.
Beta Was this translation helpful? Give feedback.
All reactions
-
👀 3
-
What kind of issues are you facing?
Beta Was this translation helpful? Give feedback.
All reactions
-
@natew tested compat with vxrn.dev or onestack.dev which is based on it ?
Beta Was this translation helpful? Give feedback.