Resolve the promise returned by Env#execute to the overall status
This commit is contained in:
@@ -669,19 +669,21 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
* the second parameter. To specify a completion callback but not a list of
|
||||
* specs/suites to run, pass null or undefined as the first parameter.
|
||||
*
|
||||
* execute should not be called more than once.
|
||||
* execute should not be called more than once unless the env has been
|
||||
* configured with `{autoCleanClosures: false}`.
|
||||
*
|
||||
* If the environment supports promises, execute will return a promise that
|
||||
* is resolved after the suite finishes executing. The promise will be
|
||||
* resolved (not rejected) as long as the suite runs to completion. Use a
|
||||
* {@link Reporter} to determine whether or not the suite passed.
|
||||
* resolved (not rejected) to the suite's overall status as long as the
|
||||
* suite runs to completion. To determine whether the suite passed, check
|
||||
* the value that the promise resolves to or use a {@link Reporter}.
|
||||
*
|
||||
* @name Env#execute
|
||||
* @since 2.0.0
|
||||
* @function
|
||||
* @param {(string[])=} runnablesToRun IDs of suites and/or specs to run
|
||||
* @param {Function=} onComplete Function that will be called after all specs have run
|
||||
* @return {Promise<undefined>}
|
||||
* @return {Promise<string>}
|
||||
*/
|
||||
this.execute = function(runnablesToRun, onComplete) {
|
||||
if (this._executedBefore) {
|
||||
@@ -747,12 +749,12 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
jasmineTimer.start();
|
||||
|
||||
return new Promise(function(resolve) {
|
||||
runAll(function() {
|
||||
runAll(function(overallStatus) {
|
||||
if (onComplete) {
|
||||
onComplete();
|
||||
}
|
||||
|
||||
resolve();
|
||||
resolve(overallStatus);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -812,7 +814,9 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
failedExpectations: topSuite.result.failedExpectations,
|
||||
deprecationWarnings: topSuite.result.deprecationWarnings
|
||||
},
|
||||
done
|
||||
function() {
|
||||
done(overallStatus);
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user