当我开始测试应用程序时,我得到了一个错误:
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:..。
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';如何解决这个错误?
发布于 2020-04-14 20:16:33
您需要在package.json中添加moduleNameMapper,请查看此链接:https://jestjs.io/docs/en/webpack#handling-static-assets
https://stackoverflow.com/questions/61207163
复制相似问题