React native 如何运行ui测试?
我开始测试应用程序时出错:React native 如何运行ui测试?,react-native,react-native-android,React Native,React Native Android,我开始测试应用程序时出错: Jest encountered an unexpected token This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript. By default, if Jest sees a Babel config, it will use that to transform y
Jest encountered an unexpected token
This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.
By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules".
Here's what you can do:
您将在文档中找到这些配置选项的更多详细信息和示例:
https://jestjs.io/docs/en/configuration.html
细节:
/home/mmvs/Desktop/ReactNative/node_modules/react导航/src/index.js:1
({“Object.”:函数(模块,导出,require,u dirname,u filename,global,jest){export*来自'@react navigation/core';
如何解决此错误?您需要在package.json中添加moduleNameMapper
查看此链接:您需要在package.json中添加moduleNameMapper 请看此链接:
You'll find more details and examples of these config options in the docs:
https://jestjs.io/docs/en/configuration.html
Details:
/home/mmvs/Desktop/ReactNative/node_modules/react-navigation/src/index.js:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){export * from '@react-navigation/core';