javascript - 修复 ScriptTransformer.js 上的 SyntaxError 从 jest 23.6 更新到 24.1
问题描述
使用 yarn 将 jest 从 23.6 更新到 24.1。获取 SyntaxError: Unexpected identifier import 不管
我尝试更新我认为可能相关的每个节点模块。
- "@babel/core": "^7.0.0",
- "@babel/polyfill": "^7.0.0",
+ "@babel/core": "^7.2.2",
+ "@babel/polyfill": "^7.2.5",
"@types/bluebird": "^3.5.24",
@@ -138,8 +138,7 @@
"@types/react-dom": "^16.0.9",
"@types/react-transition-group": "^2.0.14",
"axios-mock-adapter": "^1.15.0",
- "babel-core": "^7.0.0-bridge.0",
- "babel-jest": "^23.6.0",
+ "babel-jest": "^24.1.0",
"babel-merge": "^2.0.1",
"babel-plugin-angularjs-annotate": "^0.9.0",
"babel-plugin-dual-import": "^1.2.1",
@@ -152,7 +151,7 @@
"expect": "^1.20.2",
"fake-indexeddb": "^2.0.3",
"haml": "~0.4.3",
- "jest": "^23.6.0",
+ "jest": "^24.1.0",
"jest-junit": "^5.1.0",
"jest-styled-components": "6.3.1",
"mini-css-extract-plugin": "^0.4.0",
@@ -166,8 +165,8 @@
"stylelint-processor-styled-components": "^1.3.2",
"synchronous-promise": "^2.0.6",
"thread-loader": "^1.1.5",
- "ts-jest": "^23.10.4",
- "typescript": "^3.1.3",
+ "ts-jest": "^23.10.5",
+ "typescript": "^3.3.3",
应该yarn test
像以前一样运行。
解决方案
更新:
问题出在 jest.config.js 我们在内部模块之后声明了 node_modules:
'moduleDirectories': ['our_modules', 'node_modules']
使用新版本,这不再有效。
推荐阅读
- reinforcement-learning - RL 方法是否收敛于 epsilon = 0?
- google-apps-script - 如何让 Google Sheet 脚本在三星平板电脑上可靠运行?
- sql - 如何查找项目是否位于 SQLite 的列中?
- php - 文件内容在网页上显示错误。如何将其转换为正确的字符集?
- c# - 创建 MappingConfiguration 时具有现有密钥的项目
- javascript - 你如何在 React JS 中捕获 Django rest non_field_errors?
- python - 使用python将xml输入文件转换为选定元素csv输出文件
- hybris - SAP Hybris B2c 1905 示例 yacceleratorstorefront url 未打开
- here-api - 如何使用 HERE API 使用 pincode 或区域名称获取本地区域?
- python - 如何在python中获取外部文件的文件大小?