Skip to content

Commit db78cc0

Browse files
committed
test: added environments to testing hooks
1 parent 764316a commit db78cc0

File tree

12 files changed

+700
-494
lines changed

12 files changed

+700
-494
lines changed

.eslintrc.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
module.exports = {
22
'env': {
33
'es2021': true,
4+
'jest': true,
45
},
56
'extends': ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'],
67
'parser': '@typescript-eslint/parser',

docs-validation/tsconfig.build.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
"extends": "./tsconfig.json",
33
"compilerOptions": {
44
"paths": {}
5-
}
5+
},
6+
"exclude": ["**/__tests__/**"]
67
}

jest.setup.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// import mockSafeAreaContext from 'react-native-safe-area-context/jest/mock';
2+
// jest.mock('react-native-safe-area-context', () => mockSafeAreaContext);
3+
4+
// https://github.com/callstack/react-native-testing-library/issues/1054\
5+
// https://github.com/facebook/react/issues/20756#issuecomment-780927519
6+
// eslint-disable-next-line no-undef
7+
delete global.MessageChannel;

package.json

+18-17
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,6 @@
66
"packages/*",
77
"sample",
88
"docs-validation"
9-
],
10-
"nohoist": [
11-
"**/react",
12-
"**/react-dom",
13-
"**/react-native",
14-
"**/react-native/**",
15-
"**/react-native-dev-menu",
16-
"**/react-native-codegen",
17-
"**/@react-native-firebase/**"
189
]
1910
},
2011
"scripts": {
@@ -46,18 +37,18 @@
4637
"make:feat": "yarn workspace @sendbird/uikit-react-native create-domain"
4738
},
4839
"devDependencies": {
49-
"@testing-library/react-native": "^9.0.0",
40+
"@testing-library/react-native": "11",
5041
"@trivago/prettier-plugin-sort-imports": "^3.4.0",
51-
"@types/jest": "^27.4.0",
42+
"@types/jest": "^29.4.0",
5243
"@typescript-eslint/eslint-plugin": "^5.9.1",
5344
"@typescript-eslint/parser": "^5.9.1",
54-
"babel-jest": "^27.4.6",
45+
"babel-jest": "^29.4.3",
5546
"chalk": "^4",
5647
"conventional-changelog-conventionalcommits": "^5.0.0",
5748
"del-cli": "^4.0.1",
5849
"eslint": "^8.6.0",
5950
"eslint-config-prettier": "^8.5.0",
60-
"jest": "^27.4.7",
51+
"jest": "^29.4.3",
6152
"lerna": "^5.1.6",
6253
"patch-package": "^6.4.7",
6354
"postinstall-postinstall": "^2.1.0",
@@ -72,21 +63,31 @@
7263
"typescript": "4.9.4"
7364
},
7465
"jest": {
75-
"testEnvironment": "node",
66+
"preset": "react-native",
7667
"moduleFileExtensions": [
7768
"ts",
7869
"tsx",
7970
"js",
8071
"jsx",
8172
"json"
8273
],
74+
"setupFiles": [
75+
"<rootDir>/node_modules/react-native/jest/setup.js",
76+
"<rootDir>/jest.setup.js"
77+
],
78+
"testRegex": "/__tests__/.*\\.(test|spec)\\.(js|tsx?)$",
79+
"transformIgnorePatterns": [
80+
"node_modules/(?!(jest-)?@?react-native|@testing-library|@react-navigation|@sendbird/chat)"
81+
],
8382
"testPathIgnorePatterns": [
8483
"/node_modules/"
8584
],
86-
"testRegex": "/__tests__/.*\\.(test|spec)\\.(js|tsx?)$",
8785
"moduleNameMapper": {
88-
"@sendbird/([^/]+)": "<rootDir>/packages/$1/src"
86+
"@sendbird/chat-hooks": "<rootDir>/packages/chat-hooks/src",
87+
"@sendbird/uikit-([^/]+)": "<rootDir>/packages/uikit-$1/src"
8988
},
90-
"preset": "react-native"
89+
"coverageReporters": [
90+
"json-summary"
91+
]
9192
}
9293
}

packages/uikit-chat-hooks/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
},
4343
"devDependencies": {
4444
"@types/react": "*",
45-
"react": "^16.13.1",
45+
"react": "17.0.2",
4646
"react-native-builder-bob": "^0.18.0",
4747
"typescript": "4.9.4"
4848
},

packages/uikit-chat-hooks/tsconfig.build.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
"extends": "./tsconfig.json",
33
"compilerOptions": {
44
"paths": {}
5-
}
5+
},
6+
"exclude": ["**/__tests__/**"]
67
}

packages/uikit-react-native-foundation/tsconfig.build.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
"extends": "./tsconfig.json",
33
"compilerOptions": {
44
"paths": {}
5-
}
5+
},
6+
"exclude": ["**/__tests__/**"]
67
}

packages/uikit-react-native/tsconfig.build.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
"extends": "./tsconfig.json",
33
"compilerOptions": {
44
"paths": {}
5-
}
5+
},
6+
"exclude": ["**/__tests__/**"]
67
}

packages/uikit-utils/tsconfig.build.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
"extends": "./tsconfig.json",
33
"compilerOptions": {
44
"paths": {}
5-
}
5+
},
6+
"exclude": ["**/__tests__/**"]
67
}

sample/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"dependencies": {
1717
"@bam.tech/react-native-image-resizer": "^3.0.4",
18-
"@faker-js/faker": "^6.0.0-alpha.7",
18+
"@faker-js/faker": "^7.6.0",
1919
"@notifee/react-native": "^5.3.0",
2020
"@react-native-async-storage/async-storage": "^1.15.17",
2121
"@react-native-camera-roll/camera-roll": "^5.0.4",

0 commit comments

Comments
 (0)