Skip to content

Commit 9012320

Browse files
committed
Setup for tests
1 parent 6d562a6 commit 9012320

File tree

10 files changed

+510
-841
lines changed

10 files changed

+510
-841
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,5 @@ components.json
6767

6868
js.map
6969
.eslintcache
70+
71+
**/coverage/**

example/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"web": "expo start --web",
1111
"start": "expo start",
1212
"test": "jest",
13+
"test:coverage": "jest --coverage",
1314
"postinstall": "expo-yarn-workspaces postinstall",
1415
"example": "yarn --cwd example",
1516
"clean:modules": "rimraf node_modules"

package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"format": "prettier --write .",
1818
"lint": "eslint \"**/*.{ts,tsx}\"",
1919
"build": "lerna run build",
20+
"test": "lerna run test --stream -- --passWithNoTests",
2021
"release": "lerna publish",
2122
"example:snack": "ts-node --transpile-only scripts/upload-to-snack.ts",
2223
"clean": "lerna run clean",
@@ -35,14 +36,17 @@
3536
],
3637
"devDependencies": {
3738
"@react-native-community/eslint-config": "^3.2.0",
38-
"@types/jest": "^26.0.23",
39-
"babel-jest": "^26.6.3",
39+
"@testing-library/jest-native": "^5.4.2",
40+
"@testing-library/react-native": "^12.1.2",
41+
"@types/jest": "^29.5.0",
42+
"babel-jest": "^29.5.0",
4043
"dotenv": "^9.0.2",
4144
"eslint": "^8.18.0",
4245
"eslint-plugin-prettier": "^4.2.0",
4346
"expo-yarn-workspaces": "^2.0.0",
4447
"husky": ">=6",
45-
"jest": "^26.6.3",
48+
"jest": "^29.5.0",
49+
"jest-environment-jsdom": "^29.5.0",
4650
"json-server": "^0.16.3",
4751
"lerna": "^5.6.2",
4852
"lint-staged": ">=13",

packages/core/jest-setup.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
require("@shopify/flash-list/jestSetup");

packages/core/package.json

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
"scripts": {
1616
"clean": "rimraf lib",
1717
"clean:modules": "rimraf node_modules",
18-
"build": "yarn clean && yarn tsc"
18+
"build": "yarn clean && yarn tsc",
19+
"test": "jest",
20+
"test:coverage": "jest --coverage"
1921
},
2022
"keywords": [
2123
"react-native",
@@ -78,5 +80,18 @@
7880
"eslintIgnore": [
7981
"node_modules/",
8082
"lib/"
81-
]
83+
],
84+
"jest": {
85+
"preset": "react-native",
86+
"setupFiles": [
87+
"./jest-setup.js"
88+
],
89+
"setupFilesAfterEnv": [
90+
"@testing-library/jest-native/extend-expect"
91+
],
92+
"testPathIgnorePatterns": [
93+
"lib",
94+
"__mocks__"
95+
]
96+
}
8297
}

packages/maps/package.json

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
"scripts": {
1616
"clean": "rimraf lib",
1717
"clean:modules": "rimraf node_modules",
18-
"build": "yarn clean && yarn tsc"
18+
"build": "yarn clean && yarn tsc",
19+
"test": "jest",
20+
"test:coverage": "jest --coverage"
1921
},
2022
"keywords": [
2123
"react-native",
@@ -43,5 +45,15 @@
4345
"eslintIgnore": [
4446
"node_modules/",
4547
"lib/"
46-
]
48+
],
49+
"jest": {
50+
"preset": "react-native",
51+
"setupFilesAfterEnv": [
52+
"@testing-library/jest-native/extend-expect"
53+
],
54+
"testPathIgnorePatterns": [
55+
"lib",
56+
"__mocks__"
57+
]
58+
}
4759
}

packages/native/package.json

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
"scripts": {
1616
"clean": "rimraf lib",
1717
"clean:modules": "rimraf node_modules",
18-
"build": "yarn clean && yarn tsc"
18+
"build": "yarn clean && yarn tsc",
19+
"test": "jest",
20+
"test:coverage": "jest --coverage"
1921
},
2022
"keywords": [
2123
"react-native",
@@ -49,5 +51,15 @@
4951
"eslintIgnore": [
5052
"node_modules/",
5153
"lib/"
52-
]
54+
],
55+
"jest": {
56+
"preset": "react-native",
57+
"setupFilesAfterEnv": [
58+
"@testing-library/jest-native/extend-expect"
59+
],
60+
"testPathIgnorePatterns": [
61+
"lib",
62+
"__mocks__"
63+
]
64+
}
5365
}

packages/types/package.json

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
"scripts": {
1616
"clean": "rimraf lib",
1717
"clean:modules": "rimraf node_modules",
18-
"build": "yarn clean && yarn tsc"
18+
"build": "yarn clean && yarn tsc",
19+
"test": "jest",
20+
"test:coverage": "jest --coverage"
1921
},
2022
"keywords": [
2123
"react-native",
@@ -39,5 +41,15 @@
3941
"eslintIgnore": [
4042
"node_modules/",
4143
"lib/"
42-
]
44+
],
45+
"jest": {
46+
"preset": "react-native",
47+
"setupFilesAfterEnv": [
48+
"@testing-library/jest-native/extend-expect"
49+
],
50+
"testPathIgnorePatterns": [
51+
"lib",
52+
"__mocks__"
53+
]
54+
}
4355
}

packages/ui/package.json

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
"scripts": {
2020
"clean": "rimraf lib",
2121
"clean:modules": "rimraf node_modules",
22-
"build": "yarn clean && yarn tsc"
22+
"build": "yarn clean && yarn tsc",
23+
"test": "jest",
24+
"test:coverage": "jest --coverage"
2325
},
2426
"keywords": [
2527
"react-native",
@@ -47,5 +49,15 @@
4749
"eslintIgnore": [
4850
"node_modules/",
4951
"lib/"
50-
]
52+
],
53+
"jest": {
54+
"preset": "react-native",
55+
"setupFilesAfterEnv": [
56+
"@testing-library/jest-native/extend-expect"
57+
],
58+
"testPathIgnorePatterns": [
59+
"lib",
60+
"__mocks__"
61+
]
62+
}
5163
}

0 commit comments

Comments
 (0)