ember.jsember-cliember-componentsember-testingember-addon

Ember component creation error in 2.10


When I do Ember.Component.Create() in an unit test for mixin i get this error. I was upgrading ember from 1.13 to 2.10, this test worked fine in 1.13 but in 2.10 I get this error. Looks like in 2.10 ember component init requires an app instance.

Died on test #1     at Module.callback (http://localhost:4200/assets/tests.js:250:19)
    at Module.exports (http://localhost:4200/assets/vendor.js:131:32)
    at requireModule (http://localhost:4200/assets/vendor.js:30:18)
    at TestLoader.require (http://localhost:4200/assets/test-support.js:7104:7)
    at TestLoader.loadModules (http://localhost:4200/assets/test-support.js:7096:14)
    at Function.TestLoader.load (http://localhost:4200/assets/test-support.js:7126:22)
    at http://localhost:4200/assets/test-support.js:7009:18: Cannot instantiate a component without a renderer. Please ensure that you are creating <(subclass of Ember.Component):ember210> with a proper container/registry.@ 9 ms
Source:     
Error: Cannot instantiate a component without a renderer. Please ensure that you are creating <(subclass of Ember.Component):ember210> with a proper container/registry.
    at Class.init (http://localhost:4200/assets/vendor.js:51954:15)
    at Class.superWrapper [as init] (http://localhost:4200/assets/vendor.js:50175:22)
    at Class.init (http://localhost:4200/assets/vendor.js:50443:19)
    at Class.superWrapper (http://localhost:4200/assets/vendor.js:50175:22)
    at Class.init (http://localhost:4200/assets/vendor.js:50493:19)
    at Class.superWrapper (http://localhost:4200/assets/vendor.js:50175:22)
    at Class.exports.default._emberMetal.Mixin.create._Mixin$create.init (http://localhost:4200/assets/vendor.js:51000:17)
    at Class.superWrapper (http://localhost:4200/assets/vendor.js:50175:22)
    at Class.init (http://localhost:4200/assets/vendor.js:17472:19)
    at Class.superWrapper [as init] (http://localhost:4200/assets/vendor.js:50175:22)

Few things I have tried:


Solution

  • I tried to do renderer: this.render or other options but nothing worked, finally based on the lead I got here

    I did renderer: {} and it worked just fine.

    There are other good solutions in the link too but its not needed in my scenario since I am not rendering anything.