-
-
Notifications
You must be signed in to change notification settings - Fork 257
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
Ensure that setup
callback is invoked with the correct context.
#12
Ensure that setup
callback is invoked with the correct context.
#12
Conversation
|
||
if (this.callbacks.setup) { | ||
this.setupSteps.push( this.callbacks.setup ); | ||
delete this.callbacks.setup; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want to delete setup
from this.callbacks
before contextualizeCallbacks
is called. Otherwise, setup
will get added to cache['setup']
.
Perhaps we need another array, something like postSetupSteps
, that will be invoked with the proper this.context
. And then we should allow invokeSteps
to take a context
argument, which will be either this
or this.context
.
I can do this as a separate PR if you like or we can chat on IRC.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe to be clear we should introduce both contextualizedSetupSteps
and contextualizedTeardownSteps
, both of which will be invoked with the module's context
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, I'll update in a few....
b487fcc
to
463c20d
Compare
@dgeb - Updated per conversation in IRC and comments here. |
Previously, the `setup` callback was invoked via `invokeSteps` (and therefore was bound to the `TestModule` instance itself). Now it is invoked with the same context as the tests themselves. * Ensure `setup` callback is invoked with the test context. * Ensure `teardown` callback is invoked with the test-module context. * Removed `beforeTeardown`. * Added `afterTeardown` which is invoked with the test-module context. * Simplify callback ordering tests.
463c20d
to
b489976
Compare
Ensure that `setup` callback is invoked with the correct context.
Many thanks @rwjblue - this is a big improvement! |
Tagged as 0.3.0. |
Previously, the
setup
callback was invoked viainvokeSteps
(andtherefore was bound to the
TestModule
instance itself). Now it isinvoked with the same context as the tests themselves.
setup
callback is invoked with the test context.teardown
callback is invoked with the test context.beforeTeardown
.afterTeardown
which is invoked with the test-module context./cc @dgeb