0

我正在寻找一些帮助来解决一些非常基本的 ember 插件组件集成测试,并希望有人可能知道在哪里可以解决这个问题。测试包括以下内容:

import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';

moduleForComponent('my-comp', {
    integration: true
});

test('it renders', function(assert) {
    this.render(hbs`{{my-comp}}`);
    assert.ok(this.$());
});

test('it renders with attribute', function(assert) {
    this.render(hbs`{{my-comp title="hi"}}`);
    assert.ok(this.$());
});

test('it renders with attribute (again)', function(assert) {
    this.set('componentTitle', 'hello');
    this.render(hbs`{{my-comp title=componentTitle}}`);
    assert.ok(this.$());
});

该插件是使用 ember 蓝图创建的,所有 3 个测试都在以下 ember-try 场景中通过:

  • 默认,使用:版本:1.13.8
  • ember-release,使用:ember 2.2.0

只有具有属性的组件的测试才会在以下情况下失败:

  • ember-beta,使用:ember 2.3.0-beta.1
  • ember-canary,使用:ember 2.4.0-canary+d25e0d77

两种失败情况报告的错误是相同的:

not ok 10 PhantomJS 2.0 - component:my-comp: it renders with attribute
---
    actual: >
        null
    message: >
        Died on test #1     at test (http://localhost:7357/assets/test-support.js:1989:15)
            at http://localhost:7357/assets/dummy.js:486:19
            at http://localhost:7357/assets/vendor.js:150:34
            at tryFinally (http://localhost:7357/assets/vendor.js:30:21)
            at requireModule (http://localhost:7357/assets/vendor.js:148:15)
            at require (http://localhost:7357/assets/test-loader.js:29:16)
            at loadModules (http://localhost:7357/assets/test-loader.js:21:25)
            at load (http://localhost:7357/assets/test-loader.js:40:35)
            at http://localhost:7357/assets/test-support.js:6822:20: Assertion Failed: A helper named 'my-comp' could not be found
    Log: |
...
not ok 11 PhantomJS 2.0 - component:my-comp: it renders with attribute (again)
---
    actual: >
        null
    message: >
        Died on test #1     at test (http://localhost:7357/assets/test-support.js:1989:15)
            at http://localhost:7357/assets/dummy.js:527:19
            at http://localhost:7357/assets/vendor.js:150:34
            at tryFinally (http://localhost:7357/assets/vendor.js:30:21)
            at requireModule (http://localhost:7357/assets/vendor.js:148:15)
            at require (http://localhost:7357/assets/test-loader.js:29:16)
            at loadModules (http://localhost:7357/assets/test-loader.js:21:25)
            at load (http://localhost:7357/assets/test-loader.js:40:35)
            at http://localhost:7357/assets/test-support.js:6822:20: Assertion Failed: A helper named 'my-comp' could not be found
    Log: |
...

我的环境如下:

  • 余烬/cli:1.13.8
  • 幻影JS 2.0
4

1 回答 1

1

解决这个问题的方法是将 ember-qunit 从“0.4.9”升级到“0.4.16”。

于 2015-11-17T18:09:06.300 回答