testing application components with jest fails
See original GitHub issueGood day, we are using this amazing library in our app, a bare expo app and we faced 2 challenges. specifically with jest.
- the
main
key in package.json points to the esmodule build and not the commonjs build as expected - after loading the commonjs build, tests fail with this message:
Native RNSkia Module cannot be found
when testing a component that uses any of react-native-skia exports
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:13 (2 by maintainers)
Top Results From Across the Web
Testing components with Jest fails - Stack Overflow
I am new to Jest and Java Script in general. I wrote a test to one of my components but it seems to...
Read more >A Practical Guide To Testing React Applications With Jest
In this article, you will learn everything you need to create a solid test for your React components and application.
Read more >Testing React Apps - Jest
React 16 triggers these warnings due to how it checks element types, and the mocked module fails these checks. Your options are: Render...
Read more >How To Test a React App with Jest and React Testing Library
Press `a` to run all tests, or run Jest with `--watchAll`. Watch Usage › Press a to run all tests. › Press f...
Read more >Testing - React Native
Your app's logic would work without any React components at all! ... The default template of React Native ships with Jest testing framework....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
My solution which I can share is to mock views and methods exposed and bypass everything and return plain views for views and noop function for everything else
if you think it is useful I can make a PR
Hi @flo-sch, super awesome findings and write-up, we really appreciate this! Would be super happy if you could help with creating Mocks for the library. Maybe we could collaborate and find a solution for the
NativeSetup
issue you’re seeing - I would imagine that we could create some kind of Platform test for this - the same goes for theglobal
object issue. We already have Platform switches for Native / Web in the code!