当我使用 ES6 功能import并运行 jest 时,我收到此错误:
SyntaxError: Unexpected token import
它建议
Here's what you can do:
• To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
• If you need a custom transformation specify a "transform" option in your config.
• If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.
当我使用 Webpack 时,我不需要转换。但看起来我需要它来使用 Jest。我该怎么做?如何transform在配置中使用选项?
我在 package.json 中与 Jest 相关的所有内容是
"jest": {
"verbose": true
},
"scripts": {
"test": "jest"
},