Search code examples
ember.jsember-cliember-qunit

Attempting to register an unknown factory: `controller:application`


Here's a simplified version of my PuzzleController:

// app/controllers/puzzle.js
export default Em.ObjectController.extend({
    needs: ['application']
});

And here's my controller test:

// tests/unit/controllers/puzzle-test.js
import { 
    moduleFor,
    test
} from 'ember-qunit';

moduleFor('controller:puzzle', 'PuzzleController', { 
    needs: ['controller:application']
});

test('it exists', function() { 
    var controller = this.subject();
    ok(controller);
});

I get this error when running ember test:

Attempting to register an unknown factory: `controller:application`

I'm using Ember 1.7.0, ember-cli 0.1.1. It seems like Ember should definitely recognize the controller:application selector. Am I using the wrong syntax here?


Solution

  • I believe you'll need to create the application controller.

    Run ember g controller application and then try again.

    I don't think ember-testing will work with an automagically generated controller. You need to define it.