0
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)"
    ]
},
4

1 回答 1

0

您需要按照 docs.expo.io/versions/latet/guides/testing-with-jest 中的说明扩展 transformIgnorePatterns 列表 :) – brentvatne 2 月 14 日 1:35

于 2020-03-04T11:51:11.143 回答