Jest 遇到意外令牌 UI-Kitten
Jest encountered an unexpected token UI-Kitten
Jest encountered an unexpected token
This usually means that you are trying to import a file that Jest cannot parse, e.g. it's not plain JavaScript.
SyntaxError: Unexpected token export
1 | import React from 'react'
> 2 | import { Button, Layout, Icon } from '@ui-kitten/components'
| ^
我已经将它添加到我的 Jest 配置中,但没有发现任何变化,我的应用程序应该默认使用 babel,因为它是由安装的 expo 制作的。
"jest": {
"preset": "jest-expo",
"transformIgnorePatterns": [
"/node_modules/(?!@ui-kitten/components)"
]
},
您需要按照 docs.expo.io/versions/latet/guides/testing-with-jest 中的描述扩展 transformIgnorePatterns 列表 :) – brentvatne 2 月 14 日 1:35
Jest encountered an unexpected token
This usually means that you are trying to import a file that Jest cannot parse, e.g. it's not plain JavaScript.
SyntaxError: Unexpected token export
1 | import React from 'react'
> 2 | import { Button, Layout, Icon } from '@ui-kitten/components'
| ^
我已经将它添加到我的 Jest 配置中,但没有发现任何变化,我的应用程序应该默认使用 babel,因为它是由安装的 expo 制作的。
"jest": {
"preset": "jest-expo",
"transformIgnorePatterns": [
"/node_modules/(?!@ui-kitten/components)"
]
},
您需要按照 docs.expo.io/versions/latet/guides/testing-with-jest 中的描述扩展 transformIgnorePatterns 列表 :) – brentvatne 2 月 14 日 1:35