我正在尝试使用 Jest 在 React 应用程序中进行测试;我的应用程序使用 Vite 作为模块捆绑器。问题是,每次运行测试时都会出现以下错误:
\n > react-test@0.0.0 test\n> jest\n\n FAIL src/test/App.test.jsx\n \xe2\x97\x8f Test suite failed to run\n\n Jest encountered an unexpected token\n\n Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax.\n\n Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration.\n\n By default "node_modules" …Run Code Online (Sandbox Code Playgroud)