'Invariant Violation' exception when running tests #16
Comments
+1 |
Solved it - add this to your testHelper file:
|
What do you mean by a testHelper file? EDIT: http://stackoverflow.com/a/20780657/82156 is handy here |
@emmby the file that is loaded as the first required when testin |
Could you share the location and the exact content of your testHelper file please? |
@rseemann Can you give more context about the tsetHelper you mentioned? Is there a link that could help? |
I solved it by mocking the react-native-cookies module on my jest tests. I only clear cookies to let met token based connections don't get mess up. I mock network calls on my jests anyways, so this approach works for me. For more info on jest mocks: https://facebook.github.io/jest/docs/manual-mocks.html |
@carlos-peru |
Hi @carlos-peru do you have a gist for me, showing me how you mock the react-native-cookies module? Thank you! |
@carlos-peru a gist would be very helpful |
Any new Idea? |
mine solution "jest": {
"preset": "react-native",
"moduleDirectories":["node_modules","src","test"],
"setupFiles": ["<rootDir>/jest/setup.js"]
} in setup.js
|
@Sunshine168 so this works for you now? :) |
Im still unable to get this to work. When I add the above
I then would add
Anybody able to assist in getting this work with Jest testing? |
@simonarcher the |
I'm running into an issue while running my test suite. I get an 'Invariant Violation' exception on a line that does
require('react-native-cookies')
.Here's my stacktrace.
And here's my package.json
The text was updated successfully, but these errors were encountered: