简体   繁体   English

Jest 遇到了一个意想不到的 token 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'
        | ^

I've added this to my Jest config and seen no change, my app should use babel by default as it was made by expo which installed.我已经将它添加到我的 Jest 配置中,没有看到任何变化,我的应用程序应该默认使用 babel,因为它是由安装的 expo 制作的。

"jest": {
    "preset": "jest-expo",
    "transformIgnorePatterns": [
        "/node_modules/(?!@ui-kitten/components)"
    ]
},

you need to extend the list of transformIgnorePatterns as described in docs.expo.io/versions/latet/guides/testing-with-jest:) – brentvatne Feb 14 at 1:35您需要扩展 transformIgnorePatterns 列表,如 docs.expo.io/versions/latet/guides/testing-with-jest 中所述:) – brentvatne 2 月 14 日 1:35

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM