相关疑难解决方法(0)

运行Jest测试时出现意外的令牌'import'错误?

我已经多次问过这个问题,但我遇到的所有解决方案似乎都不适合我.我在尝试为Vue应用程序运行Jest测试时遇到以下错误.

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:
 • 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 …
Run Code Online (Sandbox Code Playgroud)

configuration vue.js jestjs babel-jest

16
推荐指数
2
解决办法
2万
查看次数

标签 统计

babel-jest ×1

configuration ×1

jestjs ×1

vue.js ×1