小编ats*_*aal的帖子

未捕获错误:找不到模块`ember-qunit`.奇怪的开箱即用的ember-cli行为

我相信我可能在这里遇到了一个环境问题,但是我很困惑我能做些什么来解决它.我创建了一个ember-cli项目,将它提交给git,添加了一些东西.我运行了典型的npm install && bower install命令并尝试过ember s.

虽然网站加载正常,但当我浏览http:// localhost:4200/tests /以确保qunit启动并运行时,我遇到了一些错误.

Uncaught Error: Could not find module `ember-qunit` imported from `ember-project/tests/test-helper

Uncaught Error: Assertion Failed: The tests file was not loaded. Make sure your tests index.html includes "assets/tests.js".

这立刻引起了一面红旗,因为我之前已经创建了几个ember项目而没有遇到类似的问题.我有我的合作伙伴(我在学校)签出项目,运行npm install && bower install && ember s并且qunit模块适合他们!

我试过git克隆一个新的repo几次,我甚至已经完全卸载节点和bower,但无论我尝试什么,我似乎无法拉出正常/测试结帐.

我的合作伙伴都在运行VM - Ubuntu和Debian,而我在Mac上,但这似乎不应该是一个大问题,特别是因为我创建了项目!

我已经看了好几个地方(这里,这里,这里),但我似乎无法得出对我有用的结论.

我和其他人一样有一个相同的bower.json.我在下面列出了我的文件结构图片,我的bower.json和my tests/index.html.

截图

以下是一些环境统计信息:

ember version: 1.13.13
node: 5.0.0
os: darwin x64
bower: 1.7.1
Run Code Online (Sandbox Code Playgroud)

我注意到的一件事是,当我这样做以查看npm的版本时有所不同,但我不确定这是否重要.

ember …
Run Code Online (Sandbox Code Playgroud)

npm ember.js bower ember-cli ember-qunit

6
推荐指数
1
解决办法
1034
查看次数

Ember单元测试组件具有冒泡动作

我正在尝试编写单元测试以确保在关闭模态时关闭属性.但是,我似乎遇到了动作处理方面的问题.我一直收到错误消息:
Error: <q12-reports@component:add-team-modal::ember294> had no action handler for: hideModal

这是modal.js组件:

stopSearch: function(modal) {
  modal.send('hideModal');

  this.setProperties({
    searchTerm: ''
  });
},

actions: {
  modalCancelled: function(modal) {
    this.stopSearch(modal);
  },
  etc...
}
Run Code Online (Sandbox Code Playgroud)

正如你所看到的那样,我正在冒泡hideModal.这是我试图编写的单元测试:

test('closing modal clears properties correctly', function(assert) {
  assert.expect(2);
  let component = this.subject();   
  let firstSearchTerm;

  Ember.run(function() {
    component.set('searchTerm', 'test');
    firstSearchTerm = component.get('searchTerm');
    assert.ok(firstSearchTerm, 'test', 'set term properly');
    component.send('modalClosed', component);
  });

  assert.ok(firstSearchTerm, '', 'clears term properly');
})
Run Code Online (Sandbox Code Playgroud)

在人们提到这一点之前,我在下面尝试过.

test('closing modal clears properties correctly', function(assert) {
  assert.expect(2);
  let component = …
Run Code Online (Sandbox Code Playgroud)

javascript unit-testing ember.js ember-cli

5
推荐指数
1
解决办法
441
查看次数