Extract spec state management out of Spec#execute
This commit is contained in:
@@ -841,6 +841,23 @@ getJasmineRequireObj().Spec = function(j$) {
|
|||||||
this.result.properties[key] = value;
|
this.result.properties[key] = value;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Spec.prototype.executionStarted = function() {
|
||||||
|
this.timer.start();
|
||||||
|
};
|
||||||
|
|
||||||
|
Spec.prototype.executionFinished = function(excluded, failSpecWithNoExp) {
|
||||||
|
if (this.autoCleanClosures) {
|
||||||
|
this.queueableFn.fn = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.result.status = this.status(excluded, failSpecWithNoExp);
|
||||||
|
this.result.duration = this.timer.elapsed();
|
||||||
|
|
||||||
|
if (this.result.status !== 'failed') {
|
||||||
|
this.result.debugLogs = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
Spec.prototype.execute = function(
|
Spec.prototype.execute = function(
|
||||||
runQueue,
|
runQueue,
|
||||||
globalErrors,
|
globalErrors,
|
||||||
@@ -854,23 +871,14 @@ getJasmineRequireObj().Spec = function(j$) {
|
|||||||
) {
|
) {
|
||||||
const start = {
|
const start = {
|
||||||
fn: done => {
|
fn: done => {
|
||||||
this.timer.start();
|
this.executionStarted();
|
||||||
onStart(done);
|
onStart(done);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const complete = {
|
const complete = {
|
||||||
fn: done => {
|
fn: done => {
|
||||||
if (this.autoCleanClosures) {
|
this.executionFinished(excluded, failSpecWithNoExp);
|
||||||
this.queueableFn.fn = null;
|
|
||||||
}
|
|
||||||
this.result.status = this.status(excluded, failSpecWithNoExp);
|
|
||||||
this.result.duration = this.timer.elapsed();
|
|
||||||
|
|
||||||
if (this.result.status !== 'failed') {
|
|
||||||
this.result.debugLogs = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
resultCallback(this.result, done);
|
resultCallback(this.result, done);
|
||||||
},
|
},
|
||||||
type: 'specCleanup'
|
type: 'specCleanup'
|
||||||
|
|||||||
@@ -69,6 +69,23 @@ getJasmineRequireObj().Spec = function(j$) {
|
|||||||
this.result.properties[key] = value;
|
this.result.properties[key] = value;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Spec.prototype.executionStarted = function() {
|
||||||
|
this.timer.start();
|
||||||
|
};
|
||||||
|
|
||||||
|
Spec.prototype.executionFinished = function(excluded, failSpecWithNoExp) {
|
||||||
|
if (this.autoCleanClosures) {
|
||||||
|
this.queueableFn.fn = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.result.status = this.status(excluded, failSpecWithNoExp);
|
||||||
|
this.result.duration = this.timer.elapsed();
|
||||||
|
|
||||||
|
if (this.result.status !== 'failed') {
|
||||||
|
this.result.debugLogs = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
Spec.prototype.execute = function(
|
Spec.prototype.execute = function(
|
||||||
runQueue,
|
runQueue,
|
||||||
globalErrors,
|
globalErrors,
|
||||||
@@ -82,23 +99,14 @@ getJasmineRequireObj().Spec = function(j$) {
|
|||||||
) {
|
) {
|
||||||
const start = {
|
const start = {
|
||||||
fn: done => {
|
fn: done => {
|
||||||
this.timer.start();
|
this.executionStarted();
|
||||||
onStart(done);
|
onStart(done);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const complete = {
|
const complete = {
|
||||||
fn: done => {
|
fn: done => {
|
||||||
if (this.autoCleanClosures) {
|
this.executionFinished(excluded, failSpecWithNoExp);
|
||||||
this.queueableFn.fn = null;
|
|
||||||
}
|
|
||||||
this.result.status = this.status(excluded, failSpecWithNoExp);
|
|
||||||
this.result.duration = this.timer.elapsed();
|
|
||||||
|
|
||||||
if (this.result.status !== 'failed') {
|
|
||||||
this.result.debugLogs = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
resultCallback(this.result, done);
|
resultCallback(this.result, done);
|
||||||
},
|
},
|
||||||
type: 'specCleanup'
|
type: 'specCleanup'
|
||||||
|
|||||||
Reference in New Issue
Block a user