You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Ember 2.18 - Not possible to test instance-initializers #16216
Hey,
as from 2.18 it is not possible to test instance initializers using current blueprint.
There are 2 errors:
Creating Application
Error: Assertion Failed: You cannot make a new Ember.Application using a root element that is an ancestor of an existing Ember.Application
Booting Application
When we built app instance application.buildInstance() it automatically boots app and fires the tested instance-initializer. So because of that, we are not able to prepare the test eg by registering own containers before running the initializer.
@Serabe Could you try with the latest ember 2.18? on 2.16 it works perfectly.
After this change Im still getting an error Assertion Failed: You cannot make a new Ember.Application using a root element that is an ancestor of an existing Ember.Application
And also, I forgot to mention: this happening for me on an addon project.
Needs reproduction: I get the error Promise rejected during "it works": Assertion Failed: You cannot make a new Ember.Application using a root element that is an ancestor of an existing Ember.Application if I create a new Ember app using 3.1.4, ember g instance-initializer my-initializer and then running ember t
Reacted by 4www, Kyle T. Edwards, Yoran Brondsema, HenryVonfire, stopdropandrew and Peter Zsoldos
Activity
rwjblue commentedon Feb 5, 2018
Please provide a reproduction, this should absolutely be possible so maybe there is an error in the specific test in question...
Exelord commentedon Feb 5, 2018
1. Code
2. Test
3. Error
What happened
The
buildInstacebooted the app before the tests so it was not possible to mock service first.Real issue
EmberExperts/ember-rollbar-client#24
Serabe commentedon Feb 8, 2018
Yes, you can. See https://github.com/Serabe/ember-issue-16216
You need to use a Service to register a service.
Closing this.
Thank you!
Exelord commentedon Feb 10, 2018
@Serabe Could you try with the latest ember 2.18? on 2.16 it works perfectly.
After this change Im still getting an error
Assertion Failed: You cannot make a new Ember.Application using a root element that is an ancestor of an existing Ember.ApplicationAnd also, I forgot to mention: this happening for me on an addon project.
Exelord commentedon Feb 10, 2018
I think this is related with new rfc: https://github.com/emberjs/ember.js/blob/master/blueprints/instance-initializer-test/qunit-rfc-232-files/tests/unit/instance-initializers/__name__-test.js
andrewtimberlake commentedon May 15, 2018
Needs reproduction: I get the error
Promise rejected during "it works": Assertion Failed: You cannot make a new Ember.Application using a root element that is an ancestor of an existing Ember.Applicationif I create a new Ember app using 3.1.4,ember g instance-initializer my-initializerand then runningember tstopdropandrew commentedon Jun 29, 2018
If you remove the
setupTest(hooks);it should work, no need to create two applications.ziali088 commentedon Jul 5, 2018
@stopdropandrew that worked and makes sense, thanks! (version 3.2)