-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Conversation
Nice! One quick comment: "before/afterAll()" sound easily confusable with "before/afterEach()" to me. What about "beforeFirst()" and "afterLast()"? |
"beforeFirst()" and "afterLast()" sound better. I went with "before/afterAll()" because I looked like the names jasmine could use to name the APIs, but it doesn't seem that they will add this functions to jasmine, so we could go with different names. |
Reviewing |
|
||
/** | ||
* Calls the before all functions and initialized the spec counter for the suites with the spec counter not | ||
* initialized and parent of the currently running spec. |
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.
I think it's fine to omit the implementation detail of the spec counter and move that comment into the code.
Initial review complete. I agree with @peterflynn on the naming. Thanks for working on this cleanup @TomMalbran! |
… and the use of this when calling the functions.
@jasonsanjose Fixes pushed. One think to notice is that when to chained suites have before or after all functions, the child suite functions will be called first, since we iterate from the spec parent to i'ts parents. Maybe this behavior could be reversed for the before first functions, having the outer most being called first and inner after. |
@TomMalbran It's not an issue with the current usage, but I agree I think that running the highest ancestor |
Implementation of beforeAll/afterAll
This pull request adds the functions
beforeAll
andafterAll
to be used inside any test suite. With these functions we can better create a test window for a complete test suite and close it at the end. Hopefully, if jasmine finally implements them, we won't need to rewrite anything besides removing the additional code added on this PR.I then updated the test suites that used a single window for all the tests to use this new functions.