Skip to content

Commit 05a2051

Browse files
committed
refactor: overhaul tests using jest
1 parent 06dd492 commit 05a2051

File tree

9 files changed

+689
-1219
lines changed

9 files changed

+689
-1219
lines changed

.eslintrc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,11 @@
3232
"react/static-property-placement": ["error", "static public field"],
3333
"@typescript-eslint/explicit-function-return-type": "off",
3434
"@typescript-eslint/no-unused-vars": ["error", { "ignoreRestSiblings": true }]
35-
}
35+
},
36+
"overrides": [
37+
{
38+
"files": ["*.test.ts", "*.test.tsx"],
39+
"env": { "jest": true, "node": true }
40+
}
41+
]
3642
}

babel.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,8 @@
77
*/
88

99
module.exports = {
10-
presets: ['module:metro-react-native-babel-preset'],
10+
presets: [
11+
'module:metro-react-native-babel-preset',
12+
'@babel/preset-typescript',
13+
],
1114
};

package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,40 +27,40 @@
2727
"scripts": {
2828
"build": "tsc",
2929
"lint": "tsc --noEmit && eslint src --ext .ts,.tsx",
30-
"test": "mocha --require @babel/register --require test/setup.js --recursive test/*.test.js"
30+
"test": "jest"
3131
},
3232
"dependencies": {
33-
"autolinker": "^3.11.1",
34-
"prop-types": "^15.7.2"
33+
"autolinker": "^3.11.1"
3534
},
3635
"devDependencies": {
3736
"@babel/core": "^7.8.4",
38-
"@babel/register": "^7.8.3",
37+
"@babel/preset-typescript": "^7.8.3",
38+
"@types/jest": "^25.1.2",
3939
"@types/react": "^16.9.19",
4040
"@types/react-native": "^0.61.12",
4141
"@typescript-eslint/eslint-plugin": "^2.19.0",
4242
"@typescript-eslint/parser": "^2.19.0",
4343
"babel-eslint": "^10.0.3",
44-
"chai": "^4.2.0",
45-
"enzyme": "^3.11.0",
46-
"enzyme-adapter-react-16": "^1.15.2",
4744
"eslint": "^5.16.0",
4845
"eslint-config-airbnb": "^18.0.1",
4946
"eslint-plugin-import": "^2.18.2",
5047
"eslint-plugin-jsx-a11y": "^6.2.3",
5148
"eslint-plugin-react": "^7.14.3",
5249
"eslint-plugin-react-hooks": "^1.7.0",
5350
"jest": "^25.1.0",
54-
"mocha": "^6.2.2",
5551
"react": "16.12.0",
5652
"react-dom": "16.12.0",
5753
"react-native": "^0.61.5",
58-
"react-native-mock-render": "^0.1.8",
59-
"sinon": "^8.1.1",
60-
"ts-node": "^8.6.2",
54+
"react-test-renderer": "^16.12.0",
6155
"typescript": "^3.7.5"
6256
},
6357
"peerDependencies": {
6458
"react-native": ">=0.25.0"
59+
},
60+
"jest": {
61+
"preset": "react-native",
62+
"transformIgnorePatterns": [
63+
"node_modules/(?!(react-native|autolinker)/)"
64+
]
6565
}
6666
}

0 commit comments

Comments
 (0)