加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

React-native jest test给出了意外的令牌

发布时间:2020-12-15 05:04:43 所属栏目:百科 来源:网络整理
导读:从组件类中获取意外的标记.寻求有关如何进行的建议. 失败: ● Test suite failed to runC:/../react-native/jest/mockComponent.js: Unexpected token (20:23) Jest encountered an unexpected token This usually means that you are trying to import a f
从组件类中获取意外的标记.寻求有关如何进行的建议.

失败:

● Test suite failed to run

C:/../react-native/jest/mockComponent.js: Unexpected token (20:23)

  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 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.
  You'll find more details and examples of these config options in the docs:
  https://jestjs.io/docs/en/configuration.html
  Details:
    18 |
    19 |   const Component = class extends SuperClass {
  > 20 |     static displayName = 'Component';
       |                        ^
    21 |
    22 |     render() {
    23 |       const name =
这对我有用 https://github.com/expo/expo/issues/2595#issuecomment-440966998

我认为问题是安装了jest和jest-expo

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读