安装并导入 Konva 和 React-konva 后,我的 jest@enzyme 测试无法运行并出现以下错误:
\n\xe2\x97\x8f 测试套件运行失败
\nJest encountered an unexpected token\n\nThis usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.\n\nBy default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules".\nRun Code Online (Sandbox Code Playgroud)\n细节:
\nC:\\avius\\fortest\\node_modules\\konva\\lib\\Core.js:1\n({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){export { Konva } from './_CoreInternals.js';\n ^^^^^^\n\nSyntaxError: Unexpected token 'export'\n\n at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1350:14)\n at Object.<anonymous> (node_modules/react-konva/lib/ReactKonvaCore.js:19:13)\nRun Code Online (Sandbox Code Playgroud)\n它是一个新创建的 create-react-app 用于测试此错误,因此没有什么特别的。\n我没有 babel.rc,也没有 babel.config.js 或 jest.config.js 文件。(因为我尝试了很多设置,都不起作用。) …