Skip to content

Commit 80308d4

Browse files
committed
Add support for testing with react@17
1 parent 5e918d5 commit 80308d4

File tree

5 files changed

+6062
-2
lines changed

5 files changed

+6062
-2
lines changed

.circleci/config.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ jobs:
3030
key: dependencies-{{ checksum "yarn.lock" }}
3131
paths:
3232
- ~/.cache/yarn
33+
- run: yarn setup:react:17
3334
- persist_to_workspace:
3435
root: .
3536
paths:
@@ -49,6 +50,13 @@ jobs:
4950
at: ~/react-native-testing-library
5051
- run: |
5152
yarn flow
53+
test:react:17:
54+
<<: *defaults
55+
steps:
56+
- attach_workspace:
57+
at: ~/react-native-testing-library
58+
- run: |
59+
yarn test:react:17
5260
tests:
5361
<<: *defaults
5462
steps:
@@ -91,6 +99,9 @@ workflows:
9199
- tests:
92100
requires:
93101
- install-dependencies
102+
- test:react:17:
103+
requires:
104+
- install-dependencies
94105
- test-website:
95106
requires:
96107
- install-dependencies

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@
8282
"build:ts": "tsc --build tsconfig.release.json",
8383
"build:ts:watch": "yarn build:ts --watch --preserveWatchOutput",
8484
"build": "yarn clean && yarn build:js && yarn build:ts && yarn copy-flowtypes",
85-
"prepare": "yarn build"
85+
"prepare": "yarn build",
86+
"setup:react:17": "del react-17-tests/src react-17-tests/jest-preset && cp -R src jestSetup.js jest-preset babel.config.js react-17-tests/ && cd react-17-tests && yarn",
87+
"test:react:17": "cd react-17-tests && yarn test"
8688
},
8789
"jest": {
8890
"preset": "./jest-preset",
@@ -91,7 +93,8 @@
9193
],
9294
"testPathIgnorePatterns": [
9395
"timerUtils",
94-
"examples/"
96+
"examples/",
97+
"react-17-tests"
9598
],
9699
"testTimeout": 60000,
97100
"transformIgnorePatterns": [

react-17-tests/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
src
2+
jest-preset
3+
jestSetup.js
4+
babel.config.js

react-17-tests/package.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"name": "react-17-tests",
3+
"description": "Execute test suite with react@17",
4+
"version": "0.0.1",
5+
"private": true,
6+
"devDependencies": {
7+
"@babel/cli": "^7.8.4",
8+
"@babel/core": "^7.9.0",
9+
"@babel/plugin-proposal-class-properties": "^7.8.3",
10+
"@babel/plugin-transform-flow-strip-types": "^7.18.0",
11+
"@babel/preset-env": "^7.9.6",
12+
"@babel/preset-flow": "^7.9.0",
13+
"@babel/preset-react": "^7.9.4",
14+
"@babel/preset-typescript": "^7.16.0",
15+
"@types/react-native": "~0.68.1",
16+
"@types/react-test-renderer": "~17.0.2",
17+
"@types/react": "~17.0.2",
18+
"babel-jest": "^29.0.2",
19+
"jest": "^29.0.2",
20+
"react-native": "0.68.1",
21+
"react-test-renderer": "~17.0.2",
22+
"react": "17.0.2"
23+
},
24+
"scripts": {
25+
"test": "jest"
26+
},
27+
"jest": {
28+
"preset": "./jest-preset",
29+
"setupFiles": [
30+
"./jestSetup.js"
31+
],
32+
"testPathIgnorePatterns": [
33+
"timerUtils"
34+
],
35+
"testTimeout": 60000,
36+
"transformIgnorePatterns": [
37+
"/node_modules/(?!(@react-native|react-native)/).*/"
38+
]
39+
}
40+
}

0 commit comments

Comments
 (0)