-
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
beforeAll/afterAll don't work with focused specs #732
Comments
This is known behavior for the current release, though I agree it is not intuitive. Is this causing you issues? |
I'm working on getting protractor to work with jasmine2.0 (angular/protractor#362), and noticed this when I was writing some tests for the integration I'm doing. It's causing me issue in the sense that I feel like this issue will be brought up as people start using jasmine. Another thing I noticed is that you can't put i.e.
will not fail, but if you replace the |
Are you using jasmine 2.1 or 2.0? |
Sorry Basically running something like this: describe('beforeEach/afterEach/it', function() {
afterAll(function() {
console.log('here');
expect(1).toEqual(2);
});
// note this is a regular 'it'. If you use 'fit', the expect in 'afterAll' works normally.
it('should share same scope', function() {
expect(1).toEqual(1); //random code
});
}); Will execute the Here's my output:
|
Failures in This happens because by the time the |
Ah, thank you for the clarification. I'll fix up the reporter to also look at the suite completion event. My original question still stands though. If you have multiple |
That is the current behavior as designed, but I probably wouldn't rely on it explicitly. We agree it's not the most awesome thing, but the |
It sounds like this is resolved now, so I'm going to close this issue. Please re-open if you feel it hasn't been fully resolved. |
FYI -this behavior is causing some confusion for Protractor users - see angular/protractor#1743. It would be great if it could be addressed in a future version, or if there were a good place to point to for documentation on how |
Not only does it run once for each it, but it seems to run additional times as well. Please see here: |
- This requires passing if runnables are set to the Suite. Hopefully in the future we will change how focused runnables and *Alls interact so this is no longer necessary. [#732]
I pushed a fix for the additional We agree that the interaction between |
Wondering why this was closed - is there a separate location we can track progress on this being fixed? (i.e. beforeAll / afterAll only being called once with a focused describe block) |
As of Jasmine 2.3, |
beforeAll
andafterAll
will run once per spec (likebeforeEach
andafterEach
) when you use focused specs:The output is:
The text was updated successfully, but these errors were encountered: