我有一个非常基本的 Ember-CLI 应用程序,运行着大约 75 个左右的 QUnit 断言,这些断言都通过了。当我生成验收测试时:
ember generate acceptance-test games
产生:
import Ember from 'ember';
import { module, test } from 'qunit';
import startApp from '../helpers/start-app';
var application;
module('Acceptance: Games', {
beforeEach: function() {
application = startApp();
},
afterEach: function() {
Ember.run(application, 'destroy');
}
});
test('visiting /games', function(assert) {
visit('/games');
andThen(function() {
assert.equal(currentPath(), 'games');
});
});
然后我的测试开始在路由的 JSHint 单元测试中中断:
52. JSHint - unit/routes/games: global failure (1, 0, 1)
1. Uncaught Error: Assertion Failed: calling set on destroyed object
Source: http://localhost:4200/assets/vendor.js:14407
我刚刚开始使用这些 Ember-CLI 集成测试,所以也许我缺少一些东西?错误似乎是我正在设置一些东西但没有在其他地方正确拆除它?即使是这种情况,我也不确定为什么添加一个验收测试会产生这种情况,而没有测试一切都通过了。
控制台还显示:
WARNING: Library "App" is already registered with Ember.
ember.debug.js:3940 Uncaught Error: Assertion Failed: calling set on destroyed object
作为参考,我在:
DEBUG: Ember : 1.10.0
DEBUG: Ember Data : 1.0.0-beta.15
DEBUG: jQuery : 1.11.2
提前致谢,
更新:
从验收测试中删除生成的代码并替换为以下内容时:
assert.ok(true);
所有的测试都通过了。只要我添加如下内容:
visit('/games');
然后,我开始在各种单元测试中随机看到“对已破坏对象的调用集”错误。