使用快照笑话测试配置反应本机 expo 应用程序

React native expo app with snapshot jest tests configuration

我无法在 React native expo 应用程序中进行 Jest 快照测试。根据一组节点模块和配置,我收到各种错误。
例子是:
* SyntaxError: Unexpected identifier import ... 或大约 import React 来自另一个文件,
* jest encountered an unexpected token import,
* 与 script_transformer 相关的错误。

这是我的 package.json

{
  "name": "empty-project-template",
  "main": "node_modules/expo/AppEntry.js",
  "private": true,
  "scripts": {
    "lint": "eslint .",
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "eject": "expo eject",
    "test": "node_modules/.bin/jest"
  },
  "dependencies": {
    "expo": "^31.0.0",
    "moment": "^2.22.2",
    "pouchdb-react-native": "^6.4.1",
    "prop-types": "^15.6.2",
    "react": "16.3.1",
    "react-native": "https://github.com/expo/react-native/archive/sdk-31.0.0.tar.gz",
    "react-native-easy-toast": "^1.1.0",
    "react-native-range-datepicker": "^1.8.2",
    "react-navigation": "^2.18.2",
    "react-redux": "^5.1.1",
    "redux": "^4.0.1",
    "redux-thunk": "^2.3.0"
  },
  "devDependencies": {
    "babel-eslint": "^10.0.1",
    "babel-plugin-syntax-class-properties": "^6.13.0",
    "babel-plugin-transform-class-properties": "^6.24.1",
    "eslint": "^5.9.0",
    "eslint-plugin-import": "^2.14.0",
    "eslint-plugin-react": "^7.11.1",
    "jest-expo": "^31.0.0",
    "react-test-renderer": "^16.7.0"
  },
  "jest": {
    "preset": "jest-expo",
    "transformIgnorePatterns": [
      "node_modules/(?!(pouchdb-react-native|pouchdb-adapter-asyncstorage))"
    ]
  }
}

谁能给我指出一个带有 Jest 快照测试的 React-native Expo 应用程序的工作 Repo。

jest-expo 现在有更好的快照支持, 检查 https://docs.expo.io/versions/latest/guides/testing-with-jest/#snapshot-test