Skip to content
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 and afterAll execute asyncronious functions inside xdescribe, unlike their -Each counterparts #1175

Closed
koroliov opened this issue Jul 31, 2016 · 3 comments · Fixed by #1225
Labels

Comments

@koroliov
Copy link

The behaviour inside disabled suites (i.e. in the xdescribe function calls) of beforeAll and beforeEach differs considerably, and I suppose this is not an expected behavior.

In the example below, if the beforeAll call is changed to beforeEach then the suite passes, otherwise it is not.

One can use such constructs to setup a requirejs module before all specs, so this is not an artificial example, it is just simplified.

describe('TestBug suite\n', function() {
  'use strict';
  xdescribe('xdecsr\n', function() {
    beforeAll(function(done) {
      setTimeout(function() {
        throw 1;
        done();
      }, 0);
    });
    it('descr', function() {
      expect(1).toEqual(1);
    });
  });
  describe('decsr\n', function() {
    it('descr', function() {
      expect(1).toEqual(1);
    });
  });
});

The same issue is with afterAll.

@slackersoft
Copy link
Member

This definitely looks like a bug in Jasmine. We would be happy to review a pull request that fixes this issue.

@slackersoft
Copy link
Member

It looks like this broke when xdescribe was switched to mark the Suite as pending instead of disabled for better consistency with xit. Since nothing will actually set a Suite to disabled, all the disabling stuff should be removed and Suites should report that that aren't executable when they are pending.

@alex-sviatenko
Copy link

alex-sviatenko commented Nov 10, 2016

Hi guys,

It seems that I found a workaround here, while this issue will be fixed.
If you set "xdescribe" and "xbeforeAll" (x can be replaced by another letter in beforeAll), test will be not executed and have pending status.
An example, result in console :
Pending:

  1. 'describe name' encountered a declaration exception
    1 spec, 0 failures, 1 pending spec

Thanks,
Alex.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants