From 61993cf1fc75b32c9704f04468c402a74c1dd1c2 Mon Sep 17 00:00:00 2001 From: Sheel Choksi Date: Tue, 29 Oct 2013 11:27:12 -0700 Subject: [PATCH] Expose Jasmine's topSuite [finishes #59774024] --- spec/core/EnvSpec.js | 6 ++++++ src/core/Env.js | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/spec/core/EnvSpec.js b/spec/core/EnvSpec.js index 30b5a319..6dd8673b 100644 --- a/spec/core/EnvSpec.js +++ b/spec/core/EnvSpec.js @@ -92,6 +92,12 @@ describe("Env", function() { }); }); + describe("#topSuite", function() { + it("returns the Jasmine top suite for users to traverse the spec tree", function() { + var suite = env.topSuite(); + expect(suite.description).toEqual('Jasmine__TopLevel__Suite'); + }); + }); }); // TODO: move these into a separate file diff --git a/src/core/Env.js b/src/core/Env.js index 923f6bd0..8825f055 100644 --- a/src/core/Env.js +++ b/src/core/Env.js @@ -150,6 +150,10 @@ getJasmineRequireObj().Env = function(j$) { runnableLookupTable[topSuite.id] = topSuite; currentSuite = topSuite; + this.topSuite = function() { + return topSuite; + }; + this.execute = function(runnablesToRun) { runnablesToRun = runnablesToRun || [topSuite.id];