在我的测试规范文件中,我使用 import 语句导入 es6 模块。我正在使用 jest test-runner 并收到以下错误 -
无法从react-native-implementation.js中找到模块warnOnce
我编辑 ./e2e/config.json 添加以下配置-
"preset": "react-native",
"transform": {
"^.+\\.js$": "../node_modules/react-native/jest/preprocessor.js"
}
Run Code Online (Sandbox Code Playgroud)
但后来我开始收到错误 - Cannot find module Platform from react-native-implementation.js
我的 .babelrc 内容 -
{
"presets": ["module:metro-react-native-babel-preset"],
"plugins": [
["@babel/plugin-proposal-decorators", {"legacy": true}]
]
}
Run Code Online (Sandbox Code Playgroud)
我尝试用类似内容的 babel.config.js 替换 .babelrc 但没有成功。我最初使用的是 mocha,但转而使用 jest,认为 jest 会立即提供这种支持。
detox ×1