-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Reverse suite afterEach behavior to match semantics? #908
Conversation
+1 - this makes the runtime order a lot more intuitive and avoids surprises. Also matches the execution in Mocha |
+1 |
Reverse suite afterEach behavior to match semantics?
When can next release be expected? |
We're working on it |
My tests just have been blown because of this change. Is there any release note, where I could know it before it happened? |
My example is:
Everything worked fine, but after this change angular's To work around it, now I have to split my helper file to two and place may
This is an insane |
We just experienced the same issue. In our case, the I agree that the reason for this change is good but in reality, this will probably break many test suites. |
Also found that |
@just-boris @rymai sorry for the breaking change, it wasn't intended. The primary reason we even considered this PR was the note from @bahmutov that mocha ran If we are going to make this change (which your use cases seem to suggest it would be a bad idea) we should have done it as part of a major version bump. I'm going to revert and drop a new release and we can have a bigger discussion about which ordering makes more sense. |
@slackersoft Thank you! |
Thanks @slackersoft! /cc @dharFr |
mocha runs afterEach in order of declaration: http://codepen.io/anon/pen/PZoGvW I believe this should be unified, fix reintroduced and released as 3.0.0. |
@m1gu3l yeah, you are right. |
In this case the (original) Jasmine behavior is correct. As several people have discovered, setting up and tearing down the state of tests behaves somewhat like a stack: the last thing you set up should be the first thing you tear down. Ordering issues become very difficult to track otherwise, as you deal with various libraries, stubs, the clock, etc. |
I'm inclined to agree with @amilligan on ordering of Jasmine won't be changing the ordering of |
I think you should document this behaviour. Introduction.js doesn't say anything about it. |
@alexander-alzate The source for the Jasmine documentation has its own github repository. We do accept pull requests for our documentation, if you'd like to help out, or issues if you have things you'd like see addressed but aren't sure how. |
Hi, thanks for the great library! I've noticed something which I have a question about.
If there are multiple
afterEach
es in a suite, they get run in reverse order of declaration. The current testspec/core/integration/SpecRunningSpec.js
appendsafterEach2
beforeafterEach1
, which is counter-intuitive to me since the test is named"should run multiple befores and afters in the order they are declared"
.I've made changes to the
Env
src file and the corresponding spec - what do you think about this behavior change?