Use enzyme for specific tests in react-native
See original GitHub issueHello,
Currently we have basic tests with react-test-renderer
as well as tests with@storybook/addon-storyshots
if I globally activate enzyme with jest:
"setupFilesAfterEnv": [
"<Rootdir> /test/setup-enzyme.ts"
]
The snapshots of my stories will not work anymore and throw this error:
● Test suite failed to run
testStorySnapshots is intended only to be used inside jest
1 | import initStoryshots from "@storybook/addon-storyshots"
2 |
> 3 | initStoryshots({
| ^
4 | configPath: "./storybook",
5 | framework: "react-native",
6 | })
at Object.testStorySnapshots [as default] (node_modules/@storybook/addon-storyshots/dist/api/index.js:37:11)
at Object.<anonymous> (test/tests/storyshots.test.ts:3:15)
I was wondering if it was possible to activate enzyme on demand, in a beforeAll()
for example.
Thanks for reply.
Issue Analytics
- State:
- Created 4 years ago
- Comments:23 (23 by maintainers)
Top Results From Across the Web
Testing stateful components using Enzyme
Enzyme is a JavaScript testing utility for React. You will mostly be using the shallow utility from Enzyme. Shallow utility helps us in...
Read more >How to set up Jest and Enzyme to test React Native apps
This short article shares my experiences setting up my testing environment to unit test React Native components with Jest and Enzyme.
Read more >Use Enzyme for testing React Native Component
This is example for use Enzyme for testing React Native Component. I have component Members.js and enter the following contents:.
Read more >Unit testing in React Native with Jest and Enzyme - Medium
With Jest we have a very easy way to test if a component is rendered correctly given certain props and state. It's called...
Read more >Unit Testing In React Native Applications - Smashing Magazine
Enzyme is a JavaScript testing framework for React Native applications. (If you're working with React rather than React Native, a guide is ...
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
Yes, i will fork and do the pull request.
Oh! it’s working with this comment on top of the test file.
So i have created a
component.enzyme.test.tsx
file.See bellow my sample: