我无法moduleFor
使用 ember-cli 0.1.5 版在新版本中工作。
当使用文档的示例代码(并且没有对应用程序进行moduleFor
其他更改)时,运行后出现以下错误ember test
:
TypeError: Attempting to register an unknown factory: `route:index`
at Object.Container.register (http://localhost:4200/assets/vendor.js:14473:17)
at isolatedContainer (http://localhost:4200/assets/test-support.js:24:19)
at Object._callbacks.setup (http://localhost:4200/assets/test-support.js:150:23)
at Object.Test.setup (http://localhost:4200/assets/test-support.js:1063:31)
at http://localhost:4200/assets/test-support.js:1168:10
at process (http://localhost:4200/assets/test-support.js:887:24)
at http://localhost:4200/assets/test-support.js:476:5
由于除了在 /tests/unit/index-test.js 中添加示例示例之外,我没有对应用程序进行任何更改moduleFor
,这似乎是一个 ember-cli 错误?作为参考,下面是moduleFor
示例的代码:
// my-app/tests/unit/index-test.js
import { test, moduleFor } from 'ember-qunit';
moduleFor('route:index', "Unit - IndexRoute", {
setup: function () {},
teardown: function () {}
});
test("it exists", function(){
ok(this.subject());
});