不确定如何处理错误 "unexpected token"

Not sure how to handle the error "unexpected token"

我正在尝试将 jest 应用于 react-redux 代码,但现在我被困在 env 设置中。看来报错跟babel有关。尽管互联网上有很多关于 "unexpected token" 的信息,但我仍然无法解决问题。列出我的设置以供参考。

如有任何建议,我们将不胜感激。

package.json 中的脚本(我使用 "npm run test" 开始测试),

  "scripts": {
    "test": "jest",
    "test:watch": "jest --watch",
    "test:clear": "jest --clearCache"
  },

babel 部分如下所示,

  "babel": {
    "env": {
      "test": {
        "presets": [
          "env"
        ],
        "only": [
          "./**/*.js",
          "node_modules/jest-runtime"
        ]
      }
    },
  }

devDependencies(babel相关的都在这里)

  "devDependencies": {
    "@babel/core": "^7.4.4",
    "@babel/preset-env": "^7.4.4",
    "@babel/runtime": "^7.4.4",
    "babel-core": "^6.26.3",
    "babel-jest": "^24.8.0",
    "babel-preset-env": "^1.7.0",
    "bili": "^4.8.0",
    "jest": "^24.8.0",
    "regenerator-runtime": "^0.13.2"
  },

笑话部分,

  "jest": {
    "setupFilesAfterEnv": [
      "<rootDir>/__tests__/setup/setupEnzyme.js"
    ],
    "testPathIgnorePatterns": [
      "<rootDir>/__tests__/setup/"
    ]
  },

我参考了 https://www.freecodecamp.org/news/how-to-set-up-jest-enzyme-like-a-boss-8455a2bc6d56/ 来建立环境。错误可能与隐藏的配置文件有关。