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];