【问题标题】:ember Error: Assertion Failed: fullName must be a proper full nameember 错误:断言失败:fullName 必须是正确的全名
【发布时间】:2018-09-18 14:06:35
【问题描述】:

使用 Ember.js 运行测试时出现以下错误:

Promise 在“...”之前被拒绝:断言失败:fullName 必须是 正确的全名

这个错误是什么意思?

【问题讨论】:

    标签: ember.js ember-qunit


    【解决方案1】:

    如果您使用新的嵌套子文件夹尖括号语法,您也可能会遇到此错误:<Foo::Bar />

    确保您拥有最新版本的ember-angle-bracket-invocation-polyfill,至少为 1.3.0

    【讨论】:

      【解决方案2】:

      原因

      如果moduleForComponent 用于单元测试并且第一个参数(组件的名称)以component: 前缀开头,则会引发此错误。

      如何解决

      您应该检查作为单元测试参数编写的组件的名称。如果使用moduleForComponent,则不应使用component: 前缀。但是,如果使用moduleFor,则应使用component: 前缀,如下例所示:

      moduleForComponent('my-component', 'unit: my-component', {
        //test specifications
      });
      

      moduleFor('component:my-component', 'unit: my-component', {
        //test specifications
      });
      

      This twiddle 演示了这两个示例的用法。

      【讨论】:

      • 我遇到了这个问题,我没有组件前缀:在我的 moduleForComponent 调用中
      • 您好,也许@Artzt 的回答可以解决您的问题。如果您可以提供更多详细信息,我们可以寻找其他修复方法。
      【解决方案3】:

      您还会看到这条带有错误路由名称的可怕消息,如下所示:

      Router.map(function () {
        this.route('mock-test/:accountId/:companyId');
        return null;
      });
      

      您将路线名称与路径段混淆了。像这样修复它:

      Router.map(function () {
        this.route('mock-test', {
          path: 'mock-test/:accountId/:companyId',
        });
        return null;
      });
      

      【讨论】:

        【解决方案4】:

        在使用一个冒号而不是 2 来分隔组件名称和子组件后,我遇到了同样令人困惑的错误。

        <Component:SubComponent /> 而不是<Component::SubComponent />

        【讨论】:

          猜你喜欢
          • 2021-04-09
          • 1970-01-01
          • 2012-11-28
          • 1970-01-01
          • 1970-01-01
          • 2019-03-23
          • 2021-01-14
          • 1970-01-01
          相关资源
          最近更新 更多