Skip to content

Commit c3f3c68

Browse files
authored
Merge pull request #339 from dohooo/develop
Support to test.
2 parents da08ea1 + e1dc22a commit c3f3c68

File tree

44 files changed

+40200
-1301
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+40200
-1301
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'react-native-reanimated-carousel': minor
3+
---
4+
5+
🚀 Support to test.

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,15 @@ export default Index;
148148
- Working principle
149149
- [About RNRC](./docs/about.md)
150150

151+
- How to run tests in `exampleExpo`
152+
```shell
153+
$ yarn prepare
154+
$ yarn link --global
155+
$ cd ./exampleExpo
156+
$ yarn link react-native-reanimated-carousel --global
157+
$ yarn test
158+
```
159+
151160
## Reason
152161

153162
<details>

README.zh-CN.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,14 @@ export default Index;
144144
- 如果你使用 EXPO 托管工作流,请确定你的 EXPO SDK 版本大于 41,因为旧的版本并不支持`Reanimated(v2)`
145145
- 工作原理
146146
- [关于RNRC](./docs/about.zh-CN.md)
147+
- 如何运行`exampleExpo`的测试
148+
```shell
149+
$ yarn prepare
150+
$ yarn link --global
151+
$ cd ./exampleExpo
152+
$ yarn link react-native-reanimated-carousel --global
153+
$ yarn test
154+
```
147155

148156
## 原因
149157

exampleExpo/babel.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ module.exports = function (api) {
1010
"react-native-reanimated/plugin",
1111
"inline-dotenv",
1212
"@babel/plugin-syntax-dynamic-import",
13+
"import-glob",
1314
];
1415

1516
if (!isProd) {

exampleExpo/package.json

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@
1111
"web": "expo start --web",
1212
"web:pretty": "PRETTY=true expo start --web",
1313
"start": "expo start",
14-
"test": "jest",
14+
"test": "jest --watch --coverage=false --changedSince=origin/main",
15+
"test:debug": "jest -o --watch --coverage=false",
16+
"test:final": "jest",
17+
"test:updateSnapshots": "jest -u --coverage=false",
18+
"test:updateSnapshots:watch": "jest -u --watch --coverage=false",
1519
"build:web": "expo build:web",
1620
"deploy": "gh-pages -d web-build",
1721
"predeploy": "yarn build:web"
@@ -26,11 +30,13 @@
2630
"@unimodules/react-native-adapter": "^6.3.9",
2731
"babel-loader": "^8.2.3",
2832
"expo": "^46.0.0",
29-
"expo-cli": "^6.1.0",
3033
"expo-blur": "~11.2.0",
34+
"expo-cli": "^6.1.0",
3135
"expo-constants": "~13.2.4",
3236
"expo-status-bar": "~1.4.0",
3337
"expo-updates": "~0.14.7",
38+
"jest": "^26.6.3",
39+
"jest-expo": "^47.0.1",
3440
"metro-config": "^0.71.1",
3541
"react": "18.0.0",
3642
"react-dom": "18.0.0",
@@ -47,8 +53,11 @@
4753
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
4854
"@babel/runtime": "^7.9.6",
4955
"@expo/webpack-config": "^0.17.0",
56+
"@testing-library/jest-native": "^5.4.1",
57+
"@testing-library/react-native": "^11.5.0",
5058
"@types/react": "~17.0.0",
5159
"@types/react-native-snap-carousel": "^3.8.5",
60+
"babel-plugin-import-glob": "^2.0.0",
5261
"babel-plugin-inline-dotenv": "^1.6.0",
5362
"babel-plugin-module-resolver": "^4.1.0",
5463
"babel-plugin-react-native-web": "^0.17.5",
@@ -61,5 +70,18 @@
6170
"resolutions": {
6271
"@types/react": "^17",
6372
"react-error-overlay": "6.0.9"
73+
},
74+
"jest": {
75+
"preset": "jest-expo",
76+
"setupFilesAfterEnv": [
77+
"./test/jest-setup.js",
78+
"@testing-library/jest-native/extend-expect"
79+
],
80+
"transformIgnorePatterns": [
81+
"node_modules/(?!((jest-)?react-native|@react-native(-community)?)|expo(nent)?|@expo(nent)?/.*|@expo-google-fonts/.*|react-navigation|@react-navigation/.*|@unimodules/.*|unimodules|sentry-expo|native-base|react-native-svg)"
82+
],
83+
"moduleDirectories": [
84+
"<rootDir>/node_modules"
85+
]
6486
}
6587
}

exampleExpo/src/Home.tsx

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,37 +11,37 @@ import {
1111
import type { NavigationProp } from "@react-navigation/native";
1212
import { useNavigation } from "@react-navigation/native";
1313

14-
import AdvancedParallaxComponent from "./advanced-parallax";
15-
import AnimTabBarComponent from "./anim-tab-bar";
16-
import BlurParallax from "./blur-parallax";
17-
import Circular from "./circular";
18-
import ComplexComponent from "./complex";
19-
import Cube3D from "./cube-3d";
20-
import Curve from "./curve";
21-
import Flow from "./flow";
22-
import Fold from "./fold";
23-
import LeftAlignComponent from "./left-align";
24-
import MarqueeComponent from "./marquee";
25-
import MultipleComponent from "./multiple";
26-
import NormalComponent from "./normal";
27-
import ParallaxComponent from "./parallax";
28-
import ParallaxLayers from "./parallax-layers";
29-
import PauseAdvancedParallaxComponent from "./pause-advanced-parallax";
30-
import PressSwipe from "./press-swipe";
31-
import RotateInOutComponent from "./rotate-in-out";
32-
import RotateScaleFadeInOutComponent from "./rotate-scale-fade-in-out";
33-
import ScaleFadeInOutComponent from "./scale-fade-in-out";
34-
import StackComponent from "./stack";
35-
import StackCards from "./stack-cards";
36-
import Tear from "./tear";
14+
import AdvancedParallaxComponent from "./pages/advanced-parallax";
15+
import AnimTabBarComponent from "./pages/anim-tab-bar";
16+
import BlurParallax from "./pages/blur-parallax";
17+
import Circular from "./pages/circular";
18+
import ComplexComponent from "./pages/complex";
19+
import Cube3D from "./pages/cube-3d";
20+
import Curve from "./pages/curve";
21+
import Flow from "./pages/flow";
22+
import Fold from "./pages/fold";
23+
import LeftAlignComponent from "./pages/left-align";
24+
import MarqueeComponent from "./pages/marquee";
25+
import MultipleComponent from "./pages/multiple";
26+
import NormalComponent from "./pages/normal";
27+
import ParallaxComponent from "./pages/parallax";
28+
import ParallaxLayers from "./pages/parallax-layers";
29+
import PauseAdvancedParallaxComponent from "./pages/pause-advanced-parallax";
30+
import PressSwipe from "./pages/press-swipe";
31+
import RotateInOutComponent from "./pages/rotate-in-out";
32+
import RotateScaleFadeInOutComponent from "./pages/rotate-scale-fade-in-out";
33+
import ScaleFadeInOutComponent from "./pages/scale-fade-in-out";
34+
import StackComponent from "./pages/stack";
35+
import StackCards from "./pages/stack-cards";
36+
import Tear from "./pages/tear";
3737
import { isAndroid, isIos } from "./utils";
3838

3939
// Not support to WEB (react-native-snap-carousel)
4040
const SnapCarouselComplexComponent = React.lazy(
41-
() => import("./snap-carousel-complex"),
41+
() => import("./pages/snap-carousel-complex"),
4242
);
4343
const SnapCarouselLoopComponent = React.lazy(
44-
() => import("./snap-carousel-loop"),
44+
() => import("./pages/snap-carousel-loop"),
4545
);
4646

4747
export const LayoutsPage = [

0 commit comments

Comments
 (0)