Fix bug where before/afterAll were being executed in disabled suites.

This commit is contained in:
Zaven Muradyan
2016-10-23 20:40:58 -07:00
parent 0e9b9a11c3
commit c21bdaf35d
5 changed files with 28 additions and 30 deletions

View File

@@ -518,6 +518,28 @@ describe("jasmine spec running", function () {
env.execute();
});
it("shouldn't run before/after functions in disabled suites", function(done) {
var shouldNotRun = jasmine.createSpy("shouldNotRun"),
suite = env.xdescribe('A disabled Suite', function() {
// None of the before/after functions should run.
env.beforeAll(shouldNotRun);
env.beforeEach(shouldNotRun);
env.afterEach(shouldNotRun);
env.afterAll(shouldNotRun);
env.it('spec inside a disabled suite', shouldNotRun);
});
var assertions = function() {
expect(shouldNotRun).not.toHaveBeenCalled();
done();
};
env.addReporter({jasmineDone: assertions});
env.execute();
});
it("should allow top level suites to be disabled", function(done) {
var specInADisabledSuite = jasmine.createSpy("specInADisabledSuite"),
otherSpec = jasmine.createSpy("otherSpec");