samedi 10 janvier 2015

ember-cli: moduleFor fails with "Attempting to register an unknown factory" error

I cannot get moduleFor to work in a fresh build using ember-cli version 0.1.5.


When using the documentation's example code for moduleFor (and no other changes to the app), I get the following error after running 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


Since I haven't made any changes to the app aside from adding the sample moduleFor example at /tests/unit/index-test.js, this seems like it may be an ember-cli bug? For reference, below is the code for the moduleFor example:



// 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());
});




Aucun commentaire:

Enregistrer un commentaire