Skip to content

Commit c476354

Browse files
zackdotcomputerKrzysztof Borowy
authored and
Krzysztof Borowy
committed
Add trailing / to transformIgnorePatterns (#146)
* Add trailing `/` to `transformIgnorePatterns` Fix a small bug with the `transformIgnorePatterns` suggested fix for performing proper transformations on the mocks for Jest compatibility. Need to add a trailing `/` to the regex for the transform ignore, otherwise it will match all packages in `node-modules` that start with the string `react-native`! * Further explanation about the transform regex As suggested by @thymikee
1 parent 104bfef commit c476354

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

docs/Jest-integration.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -71,17 +71,18 @@ You can [check its implementation](../jest/async-storage-mock.js) to get more in
7171

7272
You need to point Jest to transform this package. You can do so, by adding Async Storage path to `transformIgnorePatterns` setting in Jest's configuration.
7373

74-
7574
```json
7675
"jest": {
7776
"transformIgnorePatterns": ["node_modules/(?!(@react-native-community/async-storage/lib))"]
7877
}
7978
```
8079

81-
Optionally, you can transform whole scope for `react-native-community` and `react-native`:
80+
Optionally, you can transform all packages in the `react-native-community` and `react-native` directories by specifying this pattern:
8281

8382
```json
8483
"jest": {
85-
"transformIgnorePatterns": ["node_modules/(?!(@react-native-community|react-native))"]
84+
"transformIgnorePatterns": ["node_modules/(?!(@react-native-community|react-native)/)"]
8685
}
87-
```
86+
```
87+
88+
Or you can expand it even further to transform all packages whose names begin with `react-native` by omitting the trailing `/` in the above pattern.

0 commit comments

Comments
 (0)