Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Implementation of beforeAll/afterAll #4581

Merged
merged 2 commits into from
Jul 31, 2013

Conversation

TomMalbran
Copy link
Contributor

This pull request adds the functions beforeAll and afterAll 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.

@peterflynn
Copy link
Member

Nice! One quick comment: "before/afterAll()" sound easily confusable with "before/afterEach()" to me. What about "beforeFirst()" and "afterLast()"?

@TomMalbran
Copy link
Contributor Author

"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.

@jasonsanjose
Copy link
Member

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.
Copy link
Member

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.

@jasonsanjose
Copy link
Member

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.
@TomMalbran
Copy link
Contributor Author

@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.

@jasonsanjose
Copy link
Member

@TomMalbran It's not an issue with the current usage, but I agree I think that running the highest ancestor beforeFirst callbacks before the lower ones is a good change to make. I'll merge this now and we can follow up later.

jasonsanjose added a commit that referenced this pull request Jul 31, 2013
Implementation of beforeAll/afterAll
@jasonsanjose jasonsanjose merged commit e00c912 into adobe:master Jul 31, 2013
@TomMalbran TomMalbran deleted the tom/before-after-all branch August 6, 2013 04:37
jasonsanjose added a commit that referenced this pull request Sep 4, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants