-
Notifications
You must be signed in to change notification settings - Fork 231
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
extract load-initializers and use it in test-loader #588
extract load-initializers and use it in test-loader #588
Conversation
@stefanpenner I'm sorry I guess I'm not getting it right. from my tests if we change https://github.com/stefanpenner/ember-app-kit/blob/master/tests/helpers/start-app.js#L19 to use https://github.com/stefanpenner/ember-app-kit/blob/master/app/main.js and we call startApp() in every single acceptance test like then the initializers will be added twice and you'll get a failed assertion... |
@stefanpenner, I did a bit more digging and I believe that this is broken also in ember-cli if you checkout this commit you'll see that the tests are failing I also tried to isolate the scenario in a jsbin http://emberjs.jsbin.com/nisod/1/edit as said earlier let me know if I got this completely wrong! thanks! |
@ghedamat you are correct. A solution would be for https://github.com/stefanpenner/ember-cli/blob/master/blueprint/app/main.js#L4 to be Another would be to add initializers https://github.com/stefanpenner/ember-cli/blob/master/blueprint/app/app.js#L14 to the App Class only once, here. Likely extracting the initializer loading code to a vendor'd lib |
@stefanpenner updated, I hope I got the AMD syntax right, let me know if this is the right approach or what should I change. |
@stefanpenner agreed, I'm happy to rename to anything. the original code was let me know |
@ghedamat don't forget to add |
@ghedamat forget about it. we don't need that if it's a package |
@fsmanuel I added it in the meantime, in case @stefanpenner wants to merge this before extracting the package. thanks for noticing! |
i've added you both to: https://github.com/stefanpenner/ember-load-initializers if you can prep that package that would be great. I would love to merge it as a package |
@stefanpenner I'll give it a shot shortly |
@stefanpenner I pushed a first version to https://github.com/stefanpenner/ember-load-initializers I ended up naming it |
extract load-initializers and use it in test-loader
@ghedamat if you have time to submit to cli, that would be great. |
@stefanpenner will do shortly |
#579 added initalizers autoloading (thanks!)
This PR attempts to extract that into a separate module (maybe the path should be different) and adds the same behaviour to test loader so that they're available during tests.
test-loader.js
seems the right place to do it as it has to happen only once (App.destroy()
won't remove previously added initializers, nor it should)Let me know if this makes sense or if I'm just missing a much better way to deal with it.
Thanks!