diff --git a/lib/jasmine-core/jasmine.js b/lib/jasmine-core/jasmine.js index 088972b7..023dec91 100644 --- a/lib/jasmine-core/jasmine.js +++ b/lib/jasmine-core/jasmine.js @@ -663,6 +663,12 @@ getJasmineRequireObj().Spec = function(j$) { this.expectationFactory = attrs.expectationFactory; this.asyncExpectationFactory = attrs.asyncExpectationFactory; this.resultCallback = attrs.resultCallback || function() {}; + /** + * The unique ID of this spec. + * @name Spec#id + * @readonly + * @type {string} + */ this.id = attrs.id; this.description = attrs.description || ''; this.queueableFn = attrs.queueableFn; @@ -2026,6 +2032,7 @@ getJasmineRequireObj().Env = function(j$) { spec.pend(); } currentDeclarationSuite.addChild(spec); + return spec; }; @@ -9038,6 +9045,12 @@ getJasmineRequireObj().StackTrace = function(j$) { getJasmineRequireObj().Suite = function(j$) { function Suite(attrs) { this.env = attrs.env; + /** + * The unique ID of this suite. + * @name Suite#id + * @readonly + * @type {string} + */ this.id = attrs.id; this.parentSuite = attrs.parentSuite; this.description = attrs.description; diff --git a/spec/core/integration/SpecRunningSpec.js b/spec/core/integration/SpecRunningSpec.js index 31cae08c..96c80bb2 100644 --- a/spec/core/integration/SpecRunningSpec.js +++ b/spec/core/integration/SpecRunningSpec.js @@ -550,10 +550,17 @@ describe('spec running', function() { var pendingSpec, suite = env.describe('default current suite', function() { pendingSpec = env.it('I am a pending spec'); - }); + }), + reporter = jasmine.createSpyObj('reporter', ['specDone']); + + env.addReporter(reporter); env.execute(null, function() { - expect(pendingSpec.status()).toBe('pending'); + expect(reporter.specDone).toHaveBeenCalledWith( + jasmine.objectContaining({ + status: 'pending' + }) + ); done(); }); }); diff --git a/src/core/Env.js b/src/core/Env.js index 5ad08eb8..ef26385a 100644 --- a/src/core/Env.js +++ b/src/core/Env.js @@ -1058,6 +1058,7 @@ getJasmineRequireObj().Env = function(j$) { spec.pend(); } currentDeclarationSuite.addChild(spec); + return spec; }; diff --git a/src/core/Spec.js b/src/core/Spec.js index 4706a083..20ee9041 100644 --- a/src/core/Spec.js +++ b/src/core/Spec.js @@ -3,6 +3,12 @@ getJasmineRequireObj().Spec = function(j$) { this.expectationFactory = attrs.expectationFactory; this.asyncExpectationFactory = attrs.asyncExpectationFactory; this.resultCallback = attrs.resultCallback || function() {}; + /** + * The unique ID of this spec. + * @name Spec#id + * @readonly + * @type {string} + */ this.id = attrs.id; this.description = attrs.description || ''; this.queueableFn = attrs.queueableFn; diff --git a/src/core/Suite.js b/src/core/Suite.js index 390a72eb..0403dc02 100644 --- a/src/core/Suite.js +++ b/src/core/Suite.js @@ -1,6 +1,12 @@ getJasmineRequireObj().Suite = function(j$) { function Suite(attrs) { this.env = attrs.env; + /** + * The unique ID of this suite. + * @name Suite#id + * @readonly + * @type {string} + */ this.id = attrs.id; this.parentSuite = attrs.parentSuite; this.description = attrs.description;