Ember 2.18 - Not possible to test instance-initializers
See original GitHub issueHey, 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.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:8 (6 by maintainers)
Top Results From Across the Web
Initializers - Application Concerns - Ember Guides
Application instance initializers are run as an application instance is loaded. They provide a way to configure the initial state of your application,...
Read more >ember.js - Initialize a service on app startup without initializer
e.g. I need to be able to initialize this testing service in the app from within the service if possible.
Read more >@ember/test-helpers | Yarn - Package Manager
A test-framework-agnostic set of helpers for testing Ember.js applications. Compatibility. Ember 3.8 or above; Ember CLI 3.8 or above; Node.js 10 or above ......
Read more >Ember.js Octane vs Classic Cheat Sheet
In Octane, arguments are set on the args property, this.args . They are not set on the class instance, this . As a...
Read more >Ember.js Application instanceInitializer() Method
They are executed after the initializers of the application have been executed. Syntax: ember generate instance-initializer <initializer-name>.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

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 tIf you remove the
setupTest(hooks);it should work, no need to create two applications.