question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ember 2.18 - Not possible to test instance-initializers

See original GitHub issue

Hey, as from 2.18 it is not possible to test instance initializers using current blueprint. There are 2 errors:

  1. 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
  1. 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:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

6reactions
andrewtimberlakecommented, 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.Application if I create a new Ember app using 3.1.4, ember g instance-initializer my-initializer and then running ember t

4reactions
stopdropandrewcommented, Jun 29, 2018

If you remove the setupTest(hooks); it should work, no need to create two applications.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found