in x-test.js [873:936]
static check(context) {
if (!context.state.ended) {
// Look to see if any tests are running.
const runningStepId = context.state.stepIds.find(candidateId => {
return context.state.steps[candidateId].status === 'running';
});
if (!runningStepId) {
// If nothing's running, find the first step that's waiting and run that.
const stepId = context.state.stepIds.find(candidateId => {
return context.state.steps[candidateId].status === 'waiting';
});
if (stepId) {
const waitingStep = context.state.steps[stepId];
switch (waitingStep.type) {
case 'version':
XTestRoot.kickoffVersion(context, stepId);
XTestRoot.check(context);
break;
case 'describe-start':
XTestRoot.kickoffDescribeStart(context, stepId);
XTestRoot.check(context);
break;
case 'describe-plan':
XTestRoot.kickoffDescribePlan(context, stepId);
XTestRoot.check(context);
break;
case 'describe-end':
XTestRoot.kickoffDescribeEnd(context, stepId);
XTestRoot.check(context);
break;
case 'test-start':
XTestRoot.kickoffTestStart(context, stepId);
XTestRoot.check(context);
break;
case 'test-plan':
XTestRoot.kickoffTestPlan(context, stepId);
XTestRoot.check(context);
break;
case 'test-end':
XTestRoot.kickoffTestEnd(context, stepId);
XTestRoot.check(context);
break;
case 'it':
XTestRoot.kickoffIt(context, stepId);
XTestRoot.check(context);
break;
case 'coverage':
if (!context.state.coverage || context.state.coverageValue) {
XTestRoot.kickoffCoverage(context, stepId);
XTestRoot.check(context);
} else if (!context.state.waiting) {
XTestRoot.requestCoverageValue(context);
}
break;
case 'exit':
XTestRoot.kickoffExit(context, stepId);
break;
default:
throw new Error(`Unexpected step type "${waitingStep.type}".`);
}
}
}
}
}