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
Hi there, I've been using moduleFor() and friends for a couple of months now since Stefan invited me to take a look. I've encountered lots of "gotchas" along the way and implemented workarounds as I've gone.
I think it would be good to have a discussion about these and, where we don't remove the gotcha, document some use cases that address these issues. Here's some examples:
The isolated container doesn't perform injections - you have to handle these manually
Calling model.serialize() on a DS.Model instance fails unless you container.register('serializer:application', DS.JSONSerializer), and all of the transforms (eg. transform:string etc).
Using a FixtureStore only in testing is a challenge, the solution we have is:
I don't know enough about the concerns here, but IMHO I think it'd be good to get the isolatedContainer to inherit from the top-level container (which has the injections and resolver) in some way. I think at the very least the isolatedContainer should have a working resolver and have the same injection rules as the application container. Can we copy these over when we create the isolatedContainer?
The text was updated successfully, but these errors were encountered:
Just here to add another vote for this. This library has a lot of promise, but isolatedContainer (apparently) disregarding injections is making testing a total bitch. I thought one of the benefits of DI was to make testing easier?
Hi there, I've been using
moduleFor()
and friends for a couple of months now since Stefan invited me to take a look. I've encountered lots of "gotchas" along the way and implemented workarounds as I've gone.I think it would be good to have a discussion about these and, where we don't remove the gotcha, document some use cases that address these issues. Here's some examples:
Added call to container.reset() in teardown() function stefanpenner/ember-app-kit#465 and potential container variable leek #3
The isolated container doesn't perform injections - you have to handle these manually
Calling
model.serialize()
on aDS.Model
instance fails unless youcontainer.register('serializer:application', DS.JSONSerializer)
, and all of the transforms (eg.transform:string
etc).Using a
FixtureStore
only in testing is a challenge, the solution we have is:Pretty verbose :)
The resolver seems doesn't resolve models, so you need to manually resolve them in tests where you need them:
Here's another example from my initial feedback on
moduleFor()
I don't know enough about the concerns here, but IMHO I think it'd be good to get the
isolatedContainer
to inherit from the top-levelcontainer
(which has the injections and resolver) in some way. I think at the very least the isolatedContainer should have a workingresolver
and have the same injection rules as the application container. Can we copy these over when we create the isolatedContainer?The text was updated successfully, but these errors were encountered: