Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resetting the Ember app breaks with "cannot re-register: serializer:-default". #4056

Closed
kaukas opened this issue Jan 11, 2016 · 5 comments
Closed

Comments

@kaukas
Copy link
Contributor

kaukas commented Jan 11, 2016

Hello.

I am working on an Ember + Ember Data based application, writing some tests. Before each test I want to reset the whole application but right before the second test this leads to

Error: Cannot re-register: `serializer:-default`, as it has already been resolved.

What is the recommended way to reset the app? I cannot simply destroy and recreate the app as it is done in the Ember Data tests since the app is created once during the page load.

Thank you!

@fivetanley
Copy link
Member

This does not fix the bug but the recommended way to reset the app is to destroy and recreate the app before each test. This is the default in Ember CLI. What breaks when you do this?

@kaukas
Copy link
Contributor Author

kaukas commented Jan 11, 2016

I can not destroy and create it again because the initializing code is part of the single page app which is called only once.

It appears that this is a known problem. Strange that I am still getting it with the latest version.

@fivetanley
Copy link
Member

You should be able to destroy/create and initializers will be called again.

@bmac
Copy link
Member

bmac commented Feb 4, 2016

@kaukas what version of Ember are you using?

@kaukas
Copy link
Contributor Author

kaukas commented Feb 5, 2016

@fivetanley, as I said I can not recreate the app. It's a SPA created once in initializers.

I am on version 2.2.0. I found out that

App.reset();

is not enough. Adding

App.buildRegistry();

solved the issue for me. It seems strange that buildRegistry is not part of reset but maybe the authors had their reasons.

In any case this is not an issue of Ember Data in particular. Closing it.

@kaukas kaukas closed this as completed Feb 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants