Resolve the execute() promise to the entire JasmineDoneInfo
This matches jasmine-npm.
This commit is contained in:
@@ -1900,12 +1900,12 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
jasmineTimer.start();
|
jasmineTimer.start();
|
||||||
|
|
||||||
return new Promise(function(resolve) {
|
return new Promise(function(resolve) {
|
||||||
runAll(function(overallStatus) {
|
runAll(function(jasmineDoneInfo) {
|
||||||
if (onComplete) {
|
if (onComplete) {
|
||||||
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.
|
* @property {Expectation[]} deprecationWarnings - List of deprecation warnings that occurred at the global level.
|
||||||
* @since 2.4.0
|
* @since 2.4.0
|
||||||
*/
|
*/
|
||||||
reporter.jasmineDone(
|
const jasmineDoneInfo = {
|
||||||
{
|
overallStatus: overallStatus,
|
||||||
overallStatus: overallStatus,
|
totalTime: jasmineTimer.elapsed(),
|
||||||
totalTime: jasmineTimer.elapsed(),
|
incompleteReason: incompleteReason,
|
||||||
incompleteReason: incompleteReason,
|
order: order,
|
||||||
order: order,
|
failedExpectations: topSuite.result.failedExpectations,
|
||||||
failedExpectations: topSuite.result.failedExpectations,
|
deprecationWarnings: topSuite.result.deprecationWarnings
|
||||||
deprecationWarnings: topSuite.result.deprecationWarnings
|
};
|
||||||
},
|
reporter.jasmineDone(jasmineDoneInfo, function() {
|
||||||
function() {
|
done(jasmineDoneInfo);
|
||||||
done(overallStatus);
|
});
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ describe('Custom Spy Strategies (Integration)', function() {
|
|||||||
expect(env.createSpy('something').and.frobnicate).toBeUndefined();
|
expect(env.createSpy('something').and.frobnicate).toBeUndefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
const overallStatus = await env.execute();
|
const result = await env.execute();
|
||||||
expect(overallStatus).toEqual('passed');
|
expect(result.overallStatus).toEqual('passed');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('allows adding more strategies local to a spec', async function() {
|
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();
|
expect(env.createSpy('something').and.frobnicate).toBeUndefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
const overallStatus = await env.execute();
|
const result = await env.execute();
|
||||||
expect(overallStatus).toEqual('passed');
|
expect(result.overallStatus).toEqual('passed');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('allows using custom strategies on a per-argument basis', async function() {
|
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();
|
expect(env.createSpy('something').and.frobnicate).toBeUndefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
const overallStatus = await env.execute();
|
const result = await env.execute();
|
||||||
expect(overallStatus).toEqual('passed');
|
expect(result.overallStatus).toEqual('passed');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('allows multiple custom strategies to be used', async function() {
|
it('allows multiple custom strategies to be used', async function() {
|
||||||
@@ -112,8 +112,8 @@ describe('Custom Spy Strategies (Integration)', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
env.addReporter({ specDone: specDone });
|
env.addReporter({ specDone: specDone });
|
||||||
const overallStatus = await env.execute();
|
const result = await env.execute();
|
||||||
expect(overallStatus).toEqual('passed');
|
expect(result.overallStatus).toEqual('passed');
|
||||||
expect(specDone.calls.count()).toBe(2);
|
expect(specDone.calls.count()).toBe(2);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ describe('Default Spy Strategy (Integration)', function() {
|
|||||||
expect(spy()).toBeUndefined();
|
expect(spy()).toBeUndefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
const overallStatus = await env.execute();
|
const result = await env.execute();
|
||||||
expect(overallStatus).toEqual('passed');
|
expect(result.overallStatus).toEqual('passed');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('uses the default spy strategy defined when the spy is created', async function() {
|
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);
|
expect(d.and.isConfigured()).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
const overallStatus = await env.execute();
|
const result = await env.execute();
|
||||||
expect(overallStatus).toEqual('passed');
|
expect(result.overallStatus).toEqual('passed');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -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.describe('suite', function() {
|
||||||
env.it('spec', function() {
|
env.it('spec', function() {
|
||||||
env.expect(true).toBe(false);
|
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);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -749,12 +749,12 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
jasmineTimer.start();
|
jasmineTimer.start();
|
||||||
|
|
||||||
return new Promise(function(resolve) {
|
return new Promise(function(resolve) {
|
||||||
runAll(function(overallStatus) {
|
runAll(function(jasmineDoneInfo) {
|
||||||
if (onComplete) {
|
if (onComplete) {
|
||||||
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.
|
* @property {Expectation[]} deprecationWarnings - List of deprecation warnings that occurred at the global level.
|
||||||
* @since 2.4.0
|
* @since 2.4.0
|
||||||
*/
|
*/
|
||||||
reporter.jasmineDone(
|
const jasmineDoneInfo = {
|
||||||
{
|
overallStatus: overallStatus,
|
||||||
overallStatus: overallStatus,
|
totalTime: jasmineTimer.elapsed(),
|
||||||
totalTime: jasmineTimer.elapsed(),
|
incompleteReason: incompleteReason,
|
||||||
incompleteReason: incompleteReason,
|
order: order,
|
||||||
order: order,
|
failedExpectations: topSuite.result.failedExpectations,
|
||||||
failedExpectations: topSuite.result.failedExpectations,
|
deprecationWarnings: topSuite.result.deprecationWarnings
|
||||||
deprecationWarnings: topSuite.result.deprecationWarnings
|
};
|
||||||
},
|
reporter.jasmineDone(jasmineDoneInfo, function() {
|
||||||
function() {
|
done(jasmineDoneInfo);
|
||||||
done(overallStatus);
|
});
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user