-
Notifications
You must be signed in to change notification settings - Fork 476
Bug: Mocks broken for plain JS projects #236
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
Comments
@janhesters Whole project uses Flow, not only the Mock implementation. What preset do you use in your jest tests? |
@krizzu Here is my Jest "jest": {
"preset": "@testing-library/react-native",
"setupFilesAfterEnv": [
"@testing-library/react-native/cleanup-after-each"
],
"moduleDirectories": [
"node_modules",
"utils"
]
} |
@janhesters What about |
@janhesters any update for this? |
@krizzu module.exports = {
presets: ['module:metro-react-native-babel-preset'],
}; |
Have you tried the step from troubleshooting docs? |
Same issue, with same babel config. @krizzu there is another error text , and it did not help |
@iamolegga what error text you see? |
The same as topic starter |
I'd need more context then, like your Jest setup. Example app is a good place to lookup the config, if you need it. |
Addressed already, mocks are type-free now |
Uh oh!
There was an error while loading. Please reload this page.
Current behavior
When you follow the docs on how to integrate this module with Jest in a plain JS project, tests don't run. The reason is that the mock code references Flow types.
See also discussion in #39.
Expected behavior
The mock should work for projects that avoid static types.
Repro steps
npx react-native init myproject
) and installAsyncStorage
__mocks__/@react-native-community
directory.async-storage.js
file.Async Storage
mock.AsyncStorage
Environment
The text was updated successfully, but these errors were encountered: