我正在尝试使用Expo为我的React Native应用程序创建一个自动化的UI测试套件。我到处都在寻找好的教程,但是当我进入实际的测试写作部分时,由于诸如“意外的标识符/令牌”之类的环境问题import Icon from...或其他愚蠢的问题,我找不到任何解决方法的教程,因此我的测试甚至无法运行他们。我实际上花了一个星期的时间来解决这些问题。
我是React Native的新手,Jest / Detox / Expo的新手
这是我的package.json
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"test": "node_modules/.bin/jest test/**/*.spec.js",
"eject": "expo eject"
},
"jest": {
"verbose": true,
"preset": "jest-expo"
},
"dependencies": {
"apsl-react-native-button": "^3.1.1",
"react": "16.5.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz",
"react-native-camera": "git+https://git@github.com/react-native-community/react-native-camera.git",
"react-native-camera-roll-picker": "^1.2.3",
"react-native-elements": "^1.0.0",
"react-native-fontawesome": "^6.0.1",
"react-native-is-iphonex": "^1.0.1",
"react-native-vector-icons": "^6.2.0",
"react-navigation": "^3.1.5"
},
"devDependencies": {
"babel-preset-expo": "^5.0.0",
"bunyan-debug-stream": "^2.0.0",
"detox": "^10.0.9",
"detox-expo-helpers": "^0.6.0",
"expo-detox-hook": "^1.0.10",
"jest-expo": "^32.0.0", …Run Code Online (Sandbox Code Playgroud)