-
-
Notifications
You must be signed in to change notification settings - Fork 137
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
How to use with integration tests? #171
Comments
Hmm .. interesting .. why not use startApp for integration test? |
Yeah.. I see why you need to do it now.. I originally posted this because i was having a problem with startApp throwing exceptions regarding using the same rootelement for multiple instances of the app.. which I think i resolved (now working the way you suggested), but a bunch of people in the EmberJS Community slack, including @rwjblue, said it's a "bad" to use startApp in integration tests. |
I think your on to something though, because there might be a way to not have to do that ( startApp ) .. though it depends on how your writing the integration tests. If your using the new moduleForAcceptance thing a bob for integration tests, then you don't have to startApp, since that is doing it for you. So, to say using startApp is "bad" is going agains what they are doing. |
moduleForAcceptance is for acceptance tests, not integration tests. Acceptance tests boot a full app which means initializers run. Integration tests are attempting to be more isolated than is possible with a full application, and do not boot a full application (which means initializers are not run). My suggestion would be to provide a helpful function that folks can import and invoke in their integration test's beforeEach to ensure that this lib is properly initialized without having to rely on initializers there. |
Also, I very specifically quoted "bad" because as with everything: it isn't that simple 😈 |
Good point about acceptance vs integration tests. Good suggestion .. about providing a function .. I will ponder that one ( though it might not be so easy since I have to get access to store, and container .. ) I was hoping to think of some other way to do have FactoryGuy automatically initialize somehow but I have not been able to think of one. I am wondering if I should make FactoryGuy into a service so I can setup a directive to have it initialize with container setup .. so it's then available and ready to go as a singleton. Does this seem like a good approach? Would that work for the integration tests or other tests like moduleForComponent that setup limited containers? |
As of version 2.1.4 ( just published ) .. you can now use a method called I will close this issue. But feel free to open it again if you need to throw popcorn and beer bottles at me ( to show how unsatisfied you are ) |
👍 we are currently using manualSetup and it's working great. Thanks for that! |
Me loving that feature too. Thanks for suggestion, and let the good suggestion ( times ) roll! |
https://github.com/danielspaniel/ember-data-factory-guy/blob/v2.1.3/tests/components/dude-translator-test.js
You shouldn't use startApp in integration tests... Is there no way to do it without doing so? If i don't use startApp it can't seem to find the factories.
The text was updated successfully, but these errors were encountered: