From 8bb2f67fb3d5d393406325c7c1477a9b5e058558 Mon Sep 17 00:00:00 2001 From: slackersoft Date: Tue, 9 Dec 2014 12:40:00 -0800 Subject: [PATCH] Properly record finishing an `xdescribe` so further cleanup works Fix #724 --- lib/jasmine-core/jasmine.js | 2 +- spec/core/integration/EnvSpec.js | 37 ++++++++++++++++++++++++++++++++ src/core/Env.js | 2 +- 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/lib/jasmine-core/jasmine.js b/lib/jasmine-core/jasmine.js index 5c543254..c605058b 100644 --- a/lib/jasmine-core/jasmine.js +++ b/lib/jasmine-core/jasmine.js @@ -634,8 +634,8 @@ getJasmineRequireObj().Env = function(j$) { resultCallback: function(attrs) { if (!suite.disabled) { clearResourcesForRunnable(suite.id); - currentlyExecutingSuites.pop(); } + currentlyExecutingSuites.pop(); reporter.suiteDone(attrs); } }); diff --git a/spec/core/integration/EnvSpec.js b/spec/core/integration/EnvSpec.js index 6d7c9bb0..ea643178 100644 --- a/spec/core/integration/EnvSpec.js +++ b/spec/core/integration/EnvSpec.js @@ -1122,6 +1122,43 @@ describe("Env integration", function() { env.execute(); }); + it('should report xdescribes as expected', function(done) { + var env = new j$.Env(), + reporter = jasmine.createSpyObj('fakeReporter', [ + "jasmineStarted", + "jasmineDone", + "suiteStarted", + "suiteDone", + "specStarted", + "specDone" + ]); + + reporter.jasmineDone.and.callFake(function() { + expect(reporter.jasmineStarted).toHaveBeenCalledWith({ + totalSpecsDefined: 1 + }); + + expect(reporter.specDone).not.toHaveBeenCalled(); + expect(reporter.suiteDone.calls.count()).toBe(3); + + done(); + }); + + env.addReporter(reporter); + + env.describe("A Suite", function() { + env.describe("nested", function() { + env.xdescribe("xd out", function() { + env.it("with a spec", function() { + env.expect(true).toBe(false); + }); + }); + }); + }); + + env.execute(); + }); + it("should be possible to get full name from a spec", function() { var env = new j$.Env({global: { setTimeout: setTimeout }}), topLevelSpec, nestedSpec, doublyNestedSpec; diff --git a/src/core/Env.js b/src/core/Env.js index f6c263f3..18dce14a 100644 --- a/src/core/Env.js +++ b/src/core/Env.js @@ -240,8 +240,8 @@ getJasmineRequireObj().Env = function(j$) { resultCallback: function(attrs) { if (!suite.disabled) { clearResourcesForRunnable(suite.id); - currentlyExecutingSuites.pop(); } + currentlyExecutingSuites.pop(); reporter.suiteDone(attrs); } });