React native expo app with snapshot jest tests configuration

问题描述 投票:0回答:1

我无法在React native expo app中进行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应用程序的工作仓库。

react-native jestjs babel expo snapshot
1个回答
0
投票
© www.soinside.com 2019 - 2024. All rights reserved.