Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

Commit fe7acc7

Browse files
committed
setup jest with react-native-testing-library
1 parent 8ad1355 commit fe7acc7

File tree

5 files changed

+1970
-242
lines changed

5 files changed

+1970
-242
lines changed

babel.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
presets: ["module:metro-react-native-babel-preset"]
3+
};

jest.config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
preset: "@testing-library/react-native",
3+
verbose: true,
4+
transformIgnorePatterns: [
5+
"node_modules/(?!(jest-)?react-native|react-clone-referenced-element|@react-native-community|expo(nent)?|@expo(nent)?/.*|react-navigation|@react-navigation/.*|@unimodules/.*|unimodules|sentry-expo|native-base)"
6+
]
7+
};

package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"version": "0.0.1",
44
"description": "A React Native Masonry ScrollView that extends the inbuilt ScrollView component",
55
"scripts": {
6-
"build": "rm -rf ./lib && tsc -p ."
6+
"build": "rm -rf ./lib && tsc -p .",
7+
"test": "jest"
78
},
89
"main": "lib/index.js",
910
"author": "DaniAkash <s.daniakash@gmail.com> (https://github.com/DaniAkash)",
@@ -17,13 +18,18 @@
1718
"masonry-scroll"
1819
],
1920
"devDependencies": {
21+
"@testing-library/react-native": "^5.0.3",
22+
"@types/jest": "^25.1.1",
2023
"@types/react": "^16.9.19",
2124
"@types/react-native": "^0.61.7",
2225
"husky": "^4.2.1",
26+
"jest": "^25.1.0",
27+
"metro-react-native-babel-preset": "^0.58.0",
2328
"prettier": "^1.19.1",
2429
"pretty-quick": "^2.0.1",
2530
"react": "^16.12.0",
2631
"react-native": "^0.61.5",
32+
"react-test-renderer": "^16.12.0",
2733
"typescript": "^3.7.5"
2834
}
2935
}

tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@
4646
// "typeRoots": [], /* List of folders to include type definitions from. */
4747
"types": [
4848
"react",
49-
"react-native"
49+
"react-native",
50+
"jest"
5051
] /* Type declaration files to be included in compilation. */,
5152
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
5253
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,

0 commit comments

Comments
 (0)