diff --git a/lib/jasmine-core/jasmine.js b/lib/jasmine-core/jasmine.js index 1fadad3f..9c5a8f47 100644 --- a/lib/jasmine-core/jasmine.js +++ b/lib/jasmine-core/jasmine.js @@ -1900,12 +1900,12 @@ getJasmineRequireObj().Env = function(j$) { jasmineTimer.start(); return new Promise(function(resolve) { - runAll(function(overallStatus) { + runAll(function(jasmineDoneInfo) { if (onComplete) { onComplete(); } - resolve(overallStatus); + resolve(jasmineDoneInfo); }); }); @@ -1956,19 +1956,17 @@ getJasmineRequireObj().Env = function(j$) { * @property {Expectation[]} deprecationWarnings - List of deprecation warnings that occurred at the global level. * @since 2.4.0 */ - reporter.jasmineDone( - { - overallStatus: overallStatus, - totalTime: jasmineTimer.elapsed(), - incompleteReason: incompleteReason, - order: order, - failedExpectations: topSuite.result.failedExpectations, - deprecationWarnings: topSuite.result.deprecationWarnings - }, - function() { - done(overallStatus); - } - ); + const jasmineDoneInfo = { + overallStatus: overallStatus, + totalTime: jasmineTimer.elapsed(), + incompleteReason: incompleteReason, + order: order, + failedExpectations: topSuite.result.failedExpectations, + deprecationWarnings: topSuite.result.deprecationWarnings + }; + reporter.jasmineDone(jasmineDoneInfo, function() { + done(jasmineDoneInfo); + }); }); } ); diff --git a/spec/core/integration/CustomSpyStrategiesSpec.js b/spec/core/integration/CustomSpyStrategiesSpec.js index 3581e96b..676b00a7 100644 --- a/spec/core/integration/CustomSpyStrategiesSpec.js +++ b/spec/core/integration/CustomSpyStrategiesSpec.js @@ -31,8 +31,8 @@ describe('Custom Spy Strategies (Integration)', function() { expect(env.createSpy('something').and.frobnicate).toBeUndefined(); }); - const overallStatus = await env.execute(); - expect(overallStatus).toEqual('passed'); + const result = await env.execute(); + expect(result.overallStatus).toEqual('passed'); }); it('allows adding more strategies local to a spec', async function() { @@ -51,8 +51,8 @@ describe('Custom Spy Strategies (Integration)', function() { expect(env.createSpy('something').and.frobnicate).toBeUndefined(); }); - const overallStatus = await env.execute(); - expect(overallStatus).toEqual('passed'); + const result = await env.execute(); + expect(result.overallStatus).toEqual('passed'); }); it('allows using custom strategies on a per-argument basis', async function() { @@ -77,8 +77,8 @@ describe('Custom Spy Strategies (Integration)', function() { expect(env.createSpy('something').and.frobnicate).toBeUndefined(); }); - const overallStatus = await env.execute(); - expect(overallStatus).toEqual('passed'); + const result = await env.execute(); + expect(result.overallStatus).toEqual('passed'); }); it('allows multiple custom strategies to be used', async function() { @@ -112,8 +112,8 @@ describe('Custom Spy Strategies (Integration)', function() { }); env.addReporter({ specDone: specDone }); - const overallStatus = await env.execute(); - expect(overallStatus).toEqual('passed'); + const result = await env.execute(); + expect(result.overallStatus).toEqual('passed'); expect(specDone.calls.count()).toBe(2); }); }); diff --git a/spec/core/integration/DefaultSpyStrategySpec.js b/spec/core/integration/DefaultSpyStrategySpec.js index bbe31a76..87325817 100644 --- a/spec/core/integration/DefaultSpyStrategySpec.js +++ b/spec/core/integration/DefaultSpyStrategySpec.js @@ -29,8 +29,8 @@ describe('Default Spy Strategy (Integration)', function() { expect(spy()).toBeUndefined(); }); - const overallStatus = await env.execute(); - expect(overallStatus).toEqual('passed'); + const result = await env.execute(); + expect(result.overallStatus).toEqual('passed'); }); it('uses the default spy strategy defined when the spy is created', async function() { @@ -60,7 +60,7 @@ describe('Default Spy Strategy (Integration)', function() { expect(d.and.isConfigured()).toBe(false); }); - const overallStatus = await env.execute(); - expect(overallStatus).toEqual('passed'); + const result = await env.execute(); + expect(result.overallStatus).toEqual('passed'); }); }); diff --git a/spec/core/integration/EnvSpec.js b/spec/core/integration/EnvSpec.js index c46adbee..14d9e759 100644 --- a/spec/core/integration/EnvSpec.js +++ b/spec/core/integration/EnvSpec.js @@ -3229,14 +3229,21 @@ describe('Env integration', function() { }); }); - it('is resolved to the overall status', function() { + it('is resolved to the value of the jasmineDone event', async function() { env.describe('suite', function() { env.it('spec', function() { env.expect(true).toBe(false); }); }); - return expectAsync(env.execute(null)).toBeResolvedTo('failed'); + let event; + env.addReporter({ + jasmineDone: e => (event = e) + }); + const result = await env.execute(); + + expect(event.overallStatus).toEqual('failed'); + expect(result).toEqual(event); }); }); diff --git a/src/core/Env.js b/src/core/Env.js index 7de139b3..040f2ff5 100644 --- a/src/core/Env.js +++ b/src/core/Env.js @@ -749,12 +749,12 @@ getJasmineRequireObj().Env = function(j$) { jasmineTimer.start(); return new Promise(function(resolve) { - runAll(function(overallStatus) { + runAll(function(jasmineDoneInfo) { if (onComplete) { onComplete(); } - resolve(overallStatus); + resolve(jasmineDoneInfo); }); }); @@ -805,19 +805,17 @@ getJasmineRequireObj().Env = function(j$) { * @property {Expectation[]} deprecationWarnings - List of deprecation warnings that occurred at the global level. * @since 2.4.0 */ - reporter.jasmineDone( - { - overallStatus: overallStatus, - totalTime: jasmineTimer.elapsed(), - incompleteReason: incompleteReason, - order: order, - failedExpectations: topSuite.result.failedExpectations, - deprecationWarnings: topSuite.result.deprecationWarnings - }, - function() { - done(overallStatus); - } - ); + const jasmineDoneInfo = { + overallStatus: overallStatus, + totalTime: jasmineTimer.elapsed(), + incompleteReason: incompleteReason, + order: order, + failedExpectations: topSuite.result.failedExpectations, + deprecationWarnings: topSuite.result.deprecationWarnings + }; + reporter.jasmineDone(jasmineDoneInfo, function() { + done(jasmineDoneInfo); + }); }); } );