-
-
Notifications
You must be signed in to change notification settings - Fork 255
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
Add moduleForAcceptance #129
Add moduleForAcceptance #129
Conversation
Hmm, not sure what's up with the test error. Passes fine locally. |
28e4bf0
to
e8182d7
Compare
Added explanation to PR message |
I'm 👍 on moving this functionality to a test module in ember-test-modules and out of the blueprint. The changes look pretty solid. I'm not crazy about the name I think we need to offer some lifecycle hooks for application instances. Perhaps we could offer an application instance initializer hook which would give access to the instance and allow for custom registrations / lookups just like a regular instance initializer. We want those customizations done on the instance, not the |
(I'm also not a fan of AbstractTestModule :P) I'm not exactly sure what you mean by lifecycle hooks. I'd prefer, if possible, to not to add any extra hooks to the test module's Would implementing something like |
@mmun My main concern here is that there's access to the In other words, Our test suites could run faster if we didn't create instances of both I realize this is a change from the current blueprinted behavior, and could be handled in a separate PR / discussion if you and @rwjblue think that would be better and we just want to move this forward. This PR on its own is a good step forward. |
I'm happy to do the work for it in this PR. I just want to leave any refatoring/renaming to another PR. Would it be beneficial to share the Application across all acceptance test modules? |
Yes, I think so. There should be no state unique to a test run stored on the Application, so it should be feasible. |
e8182d7
to
e60117d
Compare
Problem
Currently the behavior necessary for starting and tearing down Ember apps in tests is located in blueprints. Blueprints expose the user to complexity and create extra boilerplate.
Solution
Create a
TestModuleForAcceptance
helper. This:testApp
directly in an acceptance testDesign
First we pulled out a
AbstractTestModule
. This is a place to put shared behavior betweenTestModule
andTestModuleForAcceptance
. It also helps crystalize what needs to be implemented in order to be a 'TestModule'. Next, we implemented aTestModuleForAcceptance
.TestModuleForAcceptance
does several things. It sets up and tears down a testApp. It provides four temporal hooks,beforeSetup
/afterTeardown
, which allow a user of the module to do things before and after the test app is created, andsetup
/teardown
which both execute while the app is running.TestModuleForAcceptance
provides options for the user of the module to customize the test app. TheApplication
option which allows you to define what the test app will be, and aconfig
where you can specify things like therootElement
.