Skip to content

feat(docs): docs for testing library #747

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions docs/pages/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,39 @@ This is because the example app is configured as a Yarn workspace, and there is
```yml
nodeLinker: node-modules
```



## Testing with React Native testing library

To test with React Native testing library, you may need to use `@react-native/babel-preset` preset for test environment in `babel.config.js` file.

```js
// babel.config.js
module.exports = {
presets: ['module:react-native-builder-bob/babel-preset'],
env: {
test: {
presets: ['module:@react-native/babel-preset'],
},
},
};
```
Then update the jest config in your `package.json` file.

```json
// package.json
"jest": {
"preset": "react-native",
"modulePathIgnorePatterns": [
"<rootDir>/example/node_modules",
"<rootDir>/lib/"
],
"transformIgnorePatterns": [
"node_modules/(?!(jest-)?react-native|@react-native|@react-native-community|react-native-reanimated)"
],
"setupFilesAfterEnv": [
"@testing-library/react-native/extend-expect"
]
},
```
Loading